<div dir="ltr"><div><div><div><div>Hi Martin,<br><br></div>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.<br><br></div>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?<br><br></div>Thanks,<br></div>Thomas<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 15 February 2016 at 08:25, Martin Teichmann <span dir="ltr"><<a href="mailto:lkb.teichmann@gmail.com" target="_blank">lkb.teichmann@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi List,<br>
<br>
over a python-ideas, we are currently discussing PEP 487:<br>
<a href="https://www.python.org/dev/peps/pep-0487/" rel="noreferrer" target="_blank">https://www.python.org/dev/peps/pep-0487/</a><br>
This proposal intends to ease the customization of class<br>
creation. Instead of using custom metaclasses the idea is<br>
to have only one metaclass in the standard library or even<br>
in Python itself.<br>
<br>
The IPython traitlets are a typical application for this<br>
proposal, and could benefit from that. This is why I<br>
converted traitlets to use a PEP 487 style metaclass and<br>
uploaded it to <a href="https://github.com/tecki/traitlets/tree/pep487" rel="noreferrer" target="_blank">https://github.com/tecki/traitlets/tree/pep487</a><br>
It works, all tests pass unmodified in both Python 2 and 3.<br>
<br>
Given that PEP 487 was written with projects like<br>
IPython traitlets in mind, I thought I ask on this list whether<br>
there are comments about it.<br>
<br>
As a note to the reader, following discussions on<br>
python-ideas, the naming of methods has changed a little<br>
since I last posted PEP 487, so the comments in<br>
<a href="https://github.com/tecki/traitlets/blob/pep487/traitlets/utils/metaclass.py" rel="noreferrer" target="_blank">https://github.com/tecki/traitlets/blob/pep487/traitlets/utils/metaclass.py</a><br>
are more accurate. I did not yet start a formal pull request,<br>
as PEP 487 is still discussed and things may still change.<br>
<br>
Greetings<br>
<br>
Martin<br>
_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/ipython-dev" rel="noreferrer" target="_blank">https://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</blockquote></div><br></div>