A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2006-July/066904.html below:

[Python-Dev] PEP 328 and PEP 338, redux

[Python-Dev] PEP 328 and PEP 338, redux [Python-Dev] PEP 328 and PEP 338, reduxAndrew Dalke andrewdalke at gmail.com
Sat Jul 1 11:59:00 CEST 2006
Giovanni Bajo <rasky at develer.com> wrote:
> Real-world usage case for import __main__? Otherwise, I say screw it :)

I have used it as a workaround for timeit.py's requirement that I pass
it strings instead of functions.

>>> def compute():
...     1+1
...
>>> import timeit
>>> t = timeit.Timer("__main__.compute()", "import __main__")
>>> t.timeit()
1.9755008220672607
>>>

You can argue (as many have) that timeit.py needs a better API for
this.  That's a different world than the existing real one.

                                Andrew
                                dalke at dalkescientific.com
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4