[Python-3000] stdlib as .zip by default, pydoc to view source?

Nick Craig-Wood nick at craig-wood.com
Mon Jun 23 13:07:00 CEST 2008


Antoine Pitrou <solipsis at pitrou.net> wrote:
>  Neil Schemenauer <nas <at> arctrix.com> writes:
> > I wonder if it would make sense to start installing the Python
> > standard library as a .zip file by default.  Some benefits would be
> > a tidier and more compact install and slightly faster startup times.
> 
>  Are any users complaining about Python's install size?
> 
>  As for startup time, do we have any eloquent data? For example, here
>  is with the current py3k on my machine:
> 
>  $ time ./python -c ""
>  0.06user 0.00system 0:00.07elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
>  0inputs+0outputs (0major+1021minor)pagefaults 0swaps

That is for a warm cache.

If you drop your caches first (like this under linux) you get quite a
different story...

$ sudo sh -c 'sync; echo 3 > /proc/sys/vm/drop_caches'
$ time python -c ""

real    0m1.393s
user    0m0.004s
sys     0m0.004s
$ time python -c ""

real    0m0.007s
user    0m0.004s
sys     0m0.004s

I imagine having the stdlib in one .zip will stop lots of seeking and
improve the first time.

> > One downside is that it becomes more difficult to look at the source
> > of modules.  That's an important feature of Python, especially for
> > people learning the language.  
> > 
> > I think that downside could be mitigated by adding an option to
> > pydoc that shows the source of a module.  For example, "pydoc -s
> > bisect" could show the source for the bisect module.
> 
>  When you have an unexpected traceback for instance it is pratical
>  to go and read the various source files participating in the traceback
>  without having to type lots of "pydoc -s" commands to get at the files.
>  (also, the traceback normally shows the exact path to the file, which
>  doesn't work if the sources are in a zip)
> 
>  It is a common argument against setuptools' "zip by default"
>  behaviour.

I like the idea of "pydoc -s" on its own.  I often want to look at the
source of modules, and end up typing "locate pymodule" then looking
through the list of files first before looking at it.  "pydoc -s
pymodule" would be much easier!

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick


More information about the Python-3000 mailing list