[Python-Dev] Add a -z interpreter flag to execute a zip file

Andy C andychup at gmail.com
Sat Jul 14 19:39:19 CEST 2007


On 7/13/07, Jim Jewett <jimjjewett at gmail.com> wrote:
> Andy C wrote:
> >... a .zip file with a __zipmain__.py module at its root?
>
> Why not just an __init__.py, which you would normally execute if you
> tried to import/run a directory?
>
> > * Magically looking at the first argument to see if it's a zip file
> > seems problematic to me.  I'd rather be explicit with the -z flag.
> > Likewise, I'd rather be explicit and call it __zipmain__ rather than
> > __main__.
>
> Treating zip files (and only zip files) as a special case equivalent
> to uncompressed files seems like a wart; I would prefer not to
> special-case zips any more than they already are.

Just to clarify, my patch already works with uncompressed directory
trees just fine.  It's just a matter of naming, I suppose.

I don't mind calling it -z and using it for directories.  But mainly
that's because no one has proprosed another name. : )  I think we've
agreed that -p is something totally different.

> > while I think it would be a bad practice to
> > import __main__,
>
> I have seen it recommended as the right place to store global
> (cross-module) settings.

Where?  People use __main__.py now?  That seems bad, because __ names
are reserved, so they should just use main.py, I would think.

Andy


More information about the Python-Dev mailing list