plain object()
Jp Calderone
exarkun at intarweb.us
Wed Apr 30 22:39:23 EDT 2003
On Thu, May 01, 2003 at 01:03:25AM +0000, Lee Harr wrote:
>
>
> Hi;
>
> Can someone explain this?
>
>
> >>> a = object()
> >>> a
> <object object at 0x8149bc0>
> >>> a.x = 3
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> AttributeError: 'object' object has no attribute 'x'
> >>> class B(object):
> ... pass
> ...
> >>> b = B()
> >>> b
> <__main__.B object at 0x81194cc>
> >>> b.x = 3
> >>> b.x
> 3
> >>>
>
print b.__dict__
print a.__dict__
Jp
--
C/C++/Java/Perl/Python/Smalltalk/PHP/ASP/XML/Linux (User+Admin)
Genetic Algorithms/Genetic Programming/Neural Networks
Networking/Multithreading/Legacy Code Maintenance/OpenGL
See my complete resume at http://intarweb.us:8080/
--
up 41 days, 23:04, 2 users, load average: 0.19, 0.08, 0.11
More information about the Python-list
mailing list