This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Arfrever, christian.heimes, pitrou, skrah, vstinner, zach.ware
Date 2013-10-29.14:31:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1383057112.09.0.256022983418.issue19229@psf.upfronthosting.co.za>
In-reply-to
Content
> Why not:
> 
> try:
>     from _operator import *
> except ImportError:
>     from _pyoperator import *

Let's try (I replaced operator.py with these 4 lines).

$ ./python -m timeit "import sys; modname='operator'" "__import__(modname); del sys.modules[modname]; del sys.modules['_operator']" 
10000 loops, best of 3: 165 usec per loop

$ ./python -m timeit "import sys; modname='operator'" "__import__(modname); del sys.modules[modname]" 
10000 loops, best of 3: 136 usec per loop

"import operator" is only 2x faster (289 usec => 136 usec). It's less interesting. And what would be the purpose of a file of 4 line which containing "import *"? Do you think that PyPy, IronPython and Jython will reuse such trampoline/wrapper?
History
Date User Action Args
2013-10-29 14:31:52vstinnersetrecipients: + vstinner, pitrou, christian.heimes, Arfrever, skrah, zach.ware
2013-10-29 14:31:52vstinnersetmessageid: <1383057112.09.0.256022983418.issue19229@psf.upfronthosting.co.za>
2013-10-29 14:31:52vstinnerlinkissue19229 messages
2013-10-29 14:31:51vstinnercreate