[Python-Dev] __file__ is not always an absolute path

Antoine Pitrou solipsis at pitrou.net
Sun Feb 7 20:05:14 CET 2010

Barry Warsaw <barry <at> python.org> writes:
> >exarkun <at> boson:~$ python -m timeit -s 'from os import getcwd' 'getcwd()'
> >1000000 loops, best of 3: 1.02 usec per loop
> I'd like to see the effect on command line scripts that are run often and then
> exit, e.g. Bazaar or Mercurial.  Start up time due to import overhead seems to
> be a constant battle for those types of projects.

If os.getcwd() is only called once when "normalizing" sys.path, and if it just
takes one microsecond, I don't really see the point. :-)


More information about the Python-Dev mailing list