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

Nick Coghlan ncoghlan at gmail.com
Sat Jun 21 08:56:47 CEST 2008


Brett Cannon wrote:
> On Fri, Jun 20, 2008 at 10:16 PM, Neil Schemenauer <nas at arctrix.com> wrote:
>> 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.
>> 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.
>>
> 
> Or zipimport grows the ability to store source and supplies the
> get_source() method as specified in PEP 302. Then pydoc can just use
> the loader to get at the source.

It already provides that (it goes and gets it out of the zipfile when 
requested). [1]

I believe the only new part that Neil is suggesting is the "-s <mod>" 
option to get pydoc to import the module and return its source code (if 
available).

So "pydoc -s <mod>" would work for an installed python and "./python -m 
pydoc -s <mod>" for an uninstalled one.

Cheers,
Nick.

[1] http://docs.python.org/lib/zipimporter-objects.html

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list