Re: Metaclasses in traitlets and PEP 487

Thomas Kluyver <[email protected]>
Newsgroups gmane.comp.python.ipython.devel
Message-ID <CAOvn4qg1ykHPq4_S+QLeFt65zH_DKQ4SWnzj4Ze=kNsEZ74sog@mail.gmail.com>
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?

Thanks,
Thomas

On 15 February 2016 at 08:25, Martin Teichmann <[email protected]>
wrote:

> 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
> [email protected]
> https://mail.scipy.org/mailman/listinfo/ipython-dev
>

_______________________________________________
IPython-dev mailing list
[email protected]
https://mail.scipy.org/mailman/listinfo/ipython-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.