[Python-ideas] PEP for executing a module in a package containing relative imports

Christian Heimes lists at cheimes.de
Fri Apr 20 19:32:45 CEST 2007

Brett Cannon schrieb:
> True, but it does introduce an import for a module that may never be
> used if the module is not being executed.  That kind of sucks for
> minor performance reasons.

Yeah but sys is used by a lot of modules. Probably 95%+ of executable
modules are either using sys directly to access sys.argv or os which
imports sys. Also sys is a builtin module which is imported ridiculously
fast. I assume that the speed penalty for scripts that don't use sys is

In my humble opinion it sucks less to force the import of a core module
that is already used by most modules than to bind valuable developer
time in the __main__ approach. I think it's a Pythonic solution as well. :)


More information about the Python-ideas mailing list