On Thu, Dec 09, 2021 at 05:19:00PM +0100, Ronald Oussoren wrote: > https://mail.python.org/pipermail/python-dev/2015-October/141953.html > is an old thread about the difference between type(x)/Py_TYPE(x) and > x.__class__ that contains some insight about this.
Thanks for the link Ronald, I remember that thread. It didn't really clarify things to me at the time, and re-reading it, it still doesn't. > Proxy types are one use case, although with some sharp edges. I'm not looking for use cases. I'm looking for a better understanding of how type() and isinstance() (and presumably issubclass) work. The best I can see is that type() sometimes believes __class__ but not always, that you can sometimes change __class__ but not always, but the rules that control when and why (or why not) are not clear or documented, as far as I can see. Is there a reference for how type(obj) and isinstance(obj, T) are intended to work, or is the implementation the only reference? Thanks in advance, -- Steve _______________________________________________ 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/GB2S2SMNDGS5UV5GG6O7HQUQSZP27OOI/ Code of Conduct: http://python.org/psf/codeofconduct/