Georg Brandl added the comment:
> That seems a little strange to me, because if an object is instance of
> a class, it should inherit all of it attributes.
An instance does not "inherit" attributes of its class. Instead, when
looking up an attribute for an instance, attributes of the class (mo
Andrew Shuiu added the comment:
Hello Murray,
That seems a little strange to me, because if an object is instance of
a class, it should inherit all of it attributes.
Is it an optimization issue? because I observed that all
instances of a class that has such "static" attributes, shares that
attr
R. David Murray added the comment:
That's because the attribute values don't exist in the instance until you make
an assignment to them. Before that the exist only as class attributes.
--
nosy: +r.david.murray
priority: -> normal
resolution: -> invalid
stage: -> committed/rejected
New submission from Andrew Shuiu :
Interpreter do not fill in __dict__ attribute of a class which has atributes.
dir() shows them, but not __dict__. It works only when attributes are created
dynamically at runtime, such as class.attribute = value, not in class
definition.
Behaviour is the same