[Python-Dev] Change PEP 399 import recommendation (was: C extension import time) (original) (raw)
Stefan Krah stefan at bytereef.org
Sat Oct 12 15:41:46 CEST 2013
- Previous message: [Python-Dev] C extension import time
- Next message: [Python-Dev] Change PEP 399 import recommendation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Nick Coghlan <ncoghlan at gmail.com> wrote:
On 12 Oct 2013 05:49, "Eric Snow" <ericsnowcurrently at gmail.com> wrote: > > On Fri, Oct 11, 2013 at 1:41 PM, Stefan Krah <stefan at bytereef.org> wrote: > > Antoine Pitrou <solipsis at pitrou.net> wrote: > >> Just create a pydecimal module (like pyio). > > > > That's very fast indeed. There's one minor problem: For backwards compatibility > > and pickling [1] I'd need to add > > > > module = 'decimal' > > > > to every class of the Python version. Are there any reasons not to do that? > > Try just putting "name = 'decimal'" at the top of the source file.
In this case the fixup needs to be conditional on the absence of "decimal". Aside from that, yes, lying about name is the easiest way to preserve pickle compatibility while still moving code around.
Thanks Eric and Nick. The setup pretty much works (see issue #19232) and the import speedup is quite large. I wonder if Cpython's startup time could be reduced if this strategy was applied to other modules as well (see #19229).
There are some concerns whether the change would impact other Python implementations, so I changed the subject (hoping for feedback).
Stefan Krah
- Previous message: [Python-Dev] C extension import time
- Next message: [Python-Dev] Change PEP 399 import recommendation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]