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
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