n is a object,what means: s='n' ?

Bruce Sass bsass at freenet.edmonton.ab.ca
Fri Aug 31 03:35:44 EDT 2001


On Fri, 31 Aug 2001, Formalin wrote:

> class now:
>     ....
>     ....
>     ....
> n=now()
> s='n'
> print s
>
> the result:<__main__.now instance at 00B2EB0C>
>
> what means?????

Cut'n'Paste is better than typing.  ;)

>>> class now: pass
...
>>> n = now()
>>> s = 'n'
>>> print s
n
>>> s2 = n
>>> print s2
<__main__.now instance at 0x805fd54>
>>> print n
<__main__.now instance at 0x805fd54>
>>>

Just what it says...
s2 and n are instances of "now", which is in the top level namespace
(i.e., __main__), and you even get the id (which just happens to be
the address in memory the object is located).


- Bruce





More information about the Python-list mailing list