[IPython-dev] Metaclasses in traitlets and PEP 487

Thomas Kluyver takowl at gmail.com
Mon Feb 15 07:16:52 EST 2016

Hi Martin,

Thanks for looking into this - it would be great to avoid maintaining our
own metaclasses in traitlets, and I know that we have somewhere knocking
around a QMetaObjectHasTraits class because of precisely the multiple
inheritance problem that you describe.

Just to check that I understand, if the PEP is accepted, we wouldn't add a
utils.metaclass module to traitlets, but instead use the new SubclassInit
class in the standard library, and an equivalent backport on PyPI for
already released Python versions, right?


On 15 February 2016 at 08:25, Martin Teichmann <lkb.teichmann at gmail.com>

> Hi List,
> over a python-ideas, we are currently discussing PEP 487:
> https://www.python.org/dev/peps/pep-0487/
> This proposal intends to ease the customization of class
> creation. Instead of using custom metaclasses the idea is
> to have only one metaclass in the standard library or even
> in Python itself.
> The IPython traitlets are a typical application for this
> proposal, and could benefit from that. This is why I
> converted traitlets to use a PEP 487 style metaclass and
> uploaded it to https://github.com/tecki/traitlets/tree/pep487
> It works, all tests pass unmodified in both Python 2 and 3.
> Given that PEP 487 was written with projects like
> IPython traitlets in mind, I thought I ask on this list whether
> there are comments about it.
> As a note to the reader, following discussions on
> python-ideas, the naming of methods has changed a little
> since I last posted PEP 487, so the comments in
> https://github.com/tecki/traitlets/blob/pep487/traitlets/utils/metaclass.py
> are more accurate. I did not yet start a formal pull request,
> as PEP 487 is still discussed and things may still change.
> Greetings
> Martin
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> https://mail.scipy.org/mailman/listinfo/ipython-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20160215/bb7a7d79/attachment.html>

More information about the IPython-dev mailing list