[IPython-dev] Metaclasses in traitlets and PEP 487

Sylvain Corlay sylvain.corlay at gmail.com
Tue Feb 16 12:06:37 EST 2016

Hi Martin,

Thank you for posting on the list about this. The separation of
`MetaHasDescriptors `in the earlier release was actually meant to
standardize on metaclass implementation that could be used for other
descriptors than trait types, very much in the spirit of you PEP.

My understanding is that the new `__set_owner__` method on the descriptor
exactly corresponds to the `class_init` in our base Descriptor class, that
is the part of the descriptor initialization that depends on the class
(while `instance_init` is the part of the initialization that depends on
the instance). However, it sometimes does a bit more than setting the name
of the owner, like in the case of the default initializers. Hence I was
wondering if the name was accurate. What do you think about simply reusing



On Mon, Feb 15, 2016 at 9:47 AM, Thomas Kluyver <takowl at gmail.com> wrote:

> On 15 February 2016 at 14:29, Martin Teichmann <lkb.teichmann at gmail.com>
> wrote:
>> This is currently the point of discussion. My current assumption is that
>> larger projects (like IPython) will certainly want to maintain backwards
>> compatibility, and are typically hesitant to add new dependencies.
>> The backport on PyPI will just be one short file which tries to import the
>> new classes in the standard library, and will fall back to an own
>> implementation.
>> One way would then be to add this PyPI package as a dependency to
>> IPython. Another way would be to simply add that simple file to IPython,
>> then we have either the backwards compatibility or the compatibility
>> with other projects (if we did find the standard library classes), but not
>> both.
> I think we'd be OK with adding a small, pure-Python dependency like that.
> It seems a bit silly to make a standardised metaclass to facilitate
> multiple inheritance, and then make independent incompatible copies of it!
> > You also mentioned situations in which you want to have compatibility
> with C++ extension metaclasses. Those will only be compatible once our new
> metaclass makes it into the interpreter proper. That will still take some
> time, though.
> Gotcha. I can still see the advantage of reducing the likelihood that
> someone else will need that kind of craziness, though.
> Thomas
> _______________________________________________
> 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/20160216/1119800a/attachment.html>

More information about the IPython-dev mailing list