Re: Metaclasses in traitlets and PEP 487
Martin Teichmann <[email protected]>
| Newsgroups | gmane.comp.python.ipython.devel |
|---|---|
| Message-ID | <CAK9R32TXDOuukm5aTb_rs2E7y+2WXuVbd3JLm6kU+MP1+VC=aw@mail.gmail.com> |
Hi Thomas, > 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? 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. The best compromise is probably to put it into a library like six, so that we have compatibility at least between projects using the same compatibility library. IPython is not using six, so I just opted for putting said one file into IPython. 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. Greetings Martin