Docstrings and PEP 3174

Carl Banks pavlovevidence at
Mon Aug 2 04:20:07 CEST 2010

On Aug 1, 4:26 pm, Terry Reedy <tjre... at> wrote:
> On 8/1/2010 4:30 AM, Gregory Ewing wrote:
> > Steven D'Aprano wrote:
> >> If you mean a runtime optimization with no change to the source file,
> >> then maybe, tell me more.
> > Note that you don't necessarily need a separate file for this.
> > It could just be a separate part of the same file.
> Which is to say, all the docstrings in a modules *could* be placed at
> the end and not normally read in by the interpreter until needed.

I'm going to guess that they don't want that in *.pyc files.  In PEP
3147 they proposed a fat-format file (so a glob for each version) and
it was not popular.

> I have
> no idea what it does now,

There's a short header, then the rest of the file is a single
marshaled glob.

> but I suspect not that. It might make module
> loading a bit faster.

True but still probably a small optimization.

Carl Banks

More information about the Python-list mailing list