[IPython-dev] Metaclasses in traitlets and PEP 487

Martin Teichmann lkb.teichmann at gmail.com
Mon Feb 15 03:25:28 EST 2016


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



More information about the IPython-dev mailing list