close

what is difference between passing data implicitly & explicitly?

Answer  From   Eric Smith   我覺得這樣的舉例跟解釋很簡單明白,但不知我的解讀對不對

 

explicitly: (明確、外顯)

passing a value into a variable, passing a value or variable into a function. You physically push the value where it needs to go.

賦予變數一個值或傳遞一個值或變數給一個function稱為外顯傳遞

 

implicitly:(內隱)

performing an action that causes data to be passed. For example, in python 2, defining a class you needed to write "class MyClass(object):", but in python 3 you only need to write "class MyClass:". 2 was more explicit in that way, that this class was actually inheriting/being passed the attributes of python's own object class. The difference in coding is the difference in definitions; explicit means you need to write it for it to happen, implicit means you rely on systems in place to make that happen for you

執行一個動作(非直接給予這麼直白)以至於產生值的傳遞

舉例:若要規劃class,在python2的寫法為 class myclass(object),python3寫法為 class myclass(object)可省略不用寫,但基本運作皆為繼承object物件—所有class(類)的物件老祖宗皆為 object,這種 implicitly行為不是直接傳遞一個值或變數,改藉由繼承動作完成資料或變數的傳遞。

其中一句 2 was more explicit in that way,也代表內外顯其實也可以是個程度比較嗎?

 

不知道這樣的理解對不對????????若有高人提點,萬分感激!!!!!!​​​​​​​

arrow
arrow
    創作者介紹
    創作者 阿丹 的頭像
    阿丹

    python愛玩客

    阿丹 發表在 痞客邦 留言(0) 人氣()