<p dir="ltr"><br>
On 10 Oct 2014 00:05, "Nathaniel Smith" <<a href="mailto:njs@pobox.com">njs@pobox.com</a>> wrote:<br>
><br>
> > Valid reasons would be to make it easier for alternative interpreters,<br>
> > or to catch edge cases (e.g. make it work nicely with custom<br>
> > importers, zip files, etc). But at that point, we can just do it the<br>
> > "right way"*, have the backcompat story to a third-party shim.<br>
> ><br>
> > * i.e. "not paying attention to older Pythons" – I'm not saying<br>
> > __new__.py is necessarily the right way, I'm criticizing this reason<br>
> > against it<br>
><br>
> My point is just that it matters whether a backcompat shim is doable. Probably there is some way to implement a backcompat shim for __new__.py, but I don't immediately know how to do it.</p>
<p dir="ltr">Eric Snow already backported the Python 3.4 importlib to Python 2.7 as importlib2, and I know of at least one large company that is planning to deploy that in order to benefit from the directory caching feature. It's a reasonably safe assumption that any future Python 3 import system changes will be made available for Python 2.7 the same way.</p>
<p dir="ltr">That said...</p>
<p dir="ltr">> And again, this is to be compared to the __class__ assignment approach, where we know very well that a backcompat shim is doable because it is done :-).</p>
<p dir="ltr">I actually agree making modules a proxy type that allows setting __class__ on instances is likely the simpler solution here.</p>
<p dir="ltr">You won't get full magic method support, but it *will* enable use of the descriptor protocol for module level attributes.</p>
<p dir="ltr">Cheers,<br>
Nick.<br></p>
<p dir="ltr">><br>
> -n<br>
><br>
><br>
> _______________________________________________<br>
> Python-ideas mailing list<br>
> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/python-ideas">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
> Code of Conduct: <a href="http://python.org/psf/codeofconduct/">http://python.org/psf/codeofconduct/</a><br>
</p>