Guido van Rossum <gu...@python.org> added the comment:

I think you're going too far for some of these.

> 1. metaclasses

This is reasonable.

> 2. __mro__

This is also reasonable. (I wonder if that part of the dir() implementation 
predates __mro__?)  I'm not sure about honoring mro() in the metaclass, but it 
may be useful.

> 3. __dict__

I think this is probably a feature -- I can't think of a reason to override 
__dict__ as a property except when implementing some sort of proxy class, and 
then it's likely that there's a matching overrid of __getattr__.

> 4. __class__

Again, I think this is a feature. For example, PEP 585 overrides __class__:

>>> t = list[int]
>>> type(t)
<class 'types.GenericAlias'>
>>> t.__class__
<class 'type'>

> 4.1 auto-creation of instance dict

This seems an accident of implementation, and if you can avoid it, that's 
better. (Though what use case of dir() currently suffers from memory overhead 
due to this?)

----------

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

Reply via email to