[Python-ideas] Simpler Customization of Class Creation - PEP 487

Michael Selik mike at selik.org
Mon Feb 8 16:24:36 EST 2016


Could you help me better understand the 3 purposes you described in the
context of multiple metaclasses?

On Fri, Feb 5, 2016 at 4:20 PM Martin Teichmann <lkb.teichmann at gmail.com>
wrote:
> a) run some code after a class is created
> b) initialize descriptors
> c) keep the order in which class attributes have been defined

This new ProvisionalMeta will allow multiple inheritance of metaclasses
using standard left-to-right priority (or the MRO for more depth). In the
case of two metaclasses, the code from Left will run immediately after the
class is created and the code from Right will go next. Right? (joking. I
should say "Correct?")

If the user doesn't want to learn about the metaclasses inside the
hierarchy, as per your explanation of the trouble with metaclass conflicts,
will they be able to make the decision about which should be Left and which
should be Right? What about cases where Left and Right interfere with each
other?

This reminds me of version control merge conflicts. It's frustrating that
the automatic merge fails, but it's better than allowing mistakes. Or am I
veering too much towards Java-land?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160208/f44b6ceb/attachment.html>


More information about the Python-ideas mailing list