On 4/22/22 22:03, Chris Angelico wrote:
Anyhow, [a forward-defined class object is] a class, with some special
features (notably that you can't instantiate it).

Yes.  Specifically, here's my intention for "forward-defined class objects": you can examine some generic dunder values (__name__, __mro__), and you can take references to it.  You can't instantiate it or meaningfully examine its contents, because it hasn't been fully initialized yet.


It seems odd that you define a blessed way of monkeypatching a class,
but then demand that it can only be done once unless you mess with
dunders. Why not just allow multiple continuations?

I think monkeypatching is bad, and I'm trying to avoid Python condoning it.

On that note, the intent of my proposal is that "continue class" is not viewed as "monkeypatching" the class, it's the second step in defining the class.

I considered attempting to prevent the user modifying the "forward-declared class object".  But a) that just seemed like an arms race with the user--"oh yeah? well watch THIS!" and b) I thought the Consenting Adults rule applied.

Still, it's not the intent of my PEP to condone or facilitate monkeypatching.


//arry/
_______________________________________________
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/CXRMKKMKIHGGPAW3F4W4QCNRDIBHFLTB/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to