On Sat, 23 Apr 2022 at 11:16, Larry Hastings <la...@hastings.org> wrote:
> This PEP proposes an additional syntax for declaring a class which splits
> this work across two statements:
> * The first statement is `forward class`, which declares the class and binds
>    the class object.
> * The second statement is `continue class`, which defines the contents
>    of the class in the "class body".
>
> [chomp all the details]

Hmm. The "continue class" part looks great IMO (and I have in fact
implemented the decorator version, which is clunky - your version,
where "continue class EXPR:" will reference any class - is way more
flexible than anything a decorator can do easily), but I'm unsure
about the forward class. How is it different from subclassing an ABC?
You're claiming a keyword (and one which is definitely going to
conflict - if this goes forward in this form, I would certainly be
bikeshedding the exact choice of keyword) for something that's
extremely similar to simply defining a class, and then marking it as
abstract.

What happens if you try to continue a non-forward class? For example:

class Demo: pass
continue class Demo: pass

If that works fine, then I'd be inclined to downgrade "forward class"
to a keyword argument (like metaclass is), eg "class
Demo(abstract=True)" or "class Demo(forward=True)".

But, I definitely like the "continue class" part of the idea, and
would love to see that happen. Of course, it's going to be horribly
abused for monkeypatching, but we could do that already anyway :)

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

Reply via email to