03.10.20 18:15, Guido van Rossum пише:
> Is this the only place where a non-class object with __bases__ is
> accepted? Or do we have more such? I recall that long ago you could use
> certain non-class objects as base classes.

The only other place is object.__dir__(). It recursively iterates the
__class__.__bases__ chain, and __class__ can be a non-type object.

The code of object.__dir__() is very old, it predates new-style classes,
and currently it gathers names using different algorithm than used in
object.__getattr__(), so object.__dir__() does not always return a list
of names accepted by object.__getattr__().

> I think all that hackery may predate (and may even have been an
> inspiration for features of) new-style classes.

I wonder whether it should pass with Python 2.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/GRSFMWDHH55KN4KZSDXSJLKWWYDF2FKE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to