module confusion

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Fri Oct 5 03:07:58 EDT 2007


Lawrence D'Oliveiro a écrit :
> In message <13gasot6r5bnu1a at corp.supernews.com>, Steven D'Aprano wrote:
> 
>> What does type(os.path) return when you try it?
> 
> It returns the type of the value contained in that variable, of course:

Certainly not. You're confusing Python with C. In Python, 'variables' 
are *not* labels for memory locations containing values. Period

>     >>> import os
>     >>> os.path = 3
>     >>> type(os.path)
>     <type 'int'>
> 
> See, it's just a variable, like any other.

This is bad faith.

 >>> import os
 >>> type(os.path)
<type 'module'>

See, this is a name bound to an object, like any other.



More information about the Python-list mailing list