[Python-ideas] PEP for executing a module in a package containing relative imports (original) (raw)
Aahz aahz at pythoncraft.com
Mon Apr 23 01:11:38 CEST 2007
- Previous message: [Python-ideas] PEP for executing a module in a package containing relative imports
- Next message: [Python-ideas] PEP for executing a module in a package containing relative imports
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, Apr 22, 2007, Steven Bethard wrote:
On 4/22/07, Christian Heimes <lists at cheimes.de> wrote:
I'm proposing the following changes: * sys.main is added which contains the dotted name of the main script. This allows code like: if name == sys.main: ... Note that this really requires the code:: import sys if name == sys.main: The import statement matters to me because 77% of my modules that use the main idiom don't import sys. Hence, for those modules, this new idiom introduces more boilerplate.
Does this follow the axiom that 83% of all statistics are made up on the spot? ;-) Seriously, if I'm writing a script that requires main, chances are excellent that it already includes sys (because it's probably a command-line script that's graduating to module status).
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"...string iteration isn't about treating strings as sequences of strings, it's about treating strings as sequences of characters. The fact that characters are also strings is the reason we have problems, but characters are strings for other good reasons." --Aahz
- Previous message: [Python-ideas] PEP for executing a module in a package containing relative imports
- Next message: [Python-ideas] PEP for executing a module in a package containing relative imports
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]