Message228570
| Author |
serhiy.storchaka |
| Recipients |
brett.cannon, eric.smith, eric.snow, ncoghlan, pitrou, serhiy.storchaka |
| Date |
2014年10月05日.14:26:34 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<3302796.27zqVUnYJV@raxxla> |
| In-reply-to |
<1412512748.14.0.876603717349.issue22557@psf.upfronthosting.co.za> |
| Content |
I'm not experienced in import machinery. Here is preliminary patch which
implements my idea for particular case.
Performance effect is almost so good as manual caching in a global.
>>> import timeit
>>> def f():
... import locale
...
>>> min(timeit.repeat(f, number=100000, repeat=10))
0.09563599999819417
Of course it breaks tests.
> It's possible there is room for other optimisations that don't break the
> import override semantics (such as a fast path for when __import__ is the
> standard import function).
Good idea. |
|