Amaury Forgeot d'Arc <[email protected]> added the comment:
In PyPy, datetime.py is a pure Python module (similar to the one in 3.x, but
without the _datetime acceleration module). So comparison with CPython is not
relevant here.
In CPython, __module__ is not an attribute of the type, but a property: it is
defined in the 'type' object. The situation is similar to the following script
(2.x syntax); the "foo" attribute can be found on the class, but not on
instances of the class.
class Type(type):
foo = 42
class Datetime:
__metaclass__ = Type
print Datetime.foo
print Datetime().foo
This is a good thing sometimes: for example 'str' has a __dict__ (containing
methods) but strings don't have a __dict__ -- storage is optimized and only has
an array of chars. In this case you wouldn't want the class __dict__ be
returned instead.
----------
nosy: +amaury.forgeotdarc
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue15223>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com