Serhiy Storchaka added the comment:

Python uses concrete class API (PyDict_GetItem and like) for resolving 
attributes. Using general mapping API would slow down attribute lookup in 
common case. This is performance critical part of Python and we should be very 
careful changing it.

On the other side, you still can have a benefit from using dict subclasses as 
__dict__. OrderedDict allows you to iterate dict in predefined order, and 
defaultdict allows you to create attributes with default values on demand (but 
__getattr__ is more universal method).

See also issue10977.

----------
nosy: +rhettinger, serhiy.storchaka

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1475692>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to