Ethan Furman wrote:
MRAB wrote:
On 14/06/2011 23:28, Eric Snow wrote:
I would rather have something like this:

   """some module"""

   import sys
   import importlib
   import util  # some utility module somewhere...

   if __name__ == "__main__":
       name = util.get_module_name(sys.modules[__name__])
       module = importlib.import_module(name)
       sys.modules[__name__] = module
       break

   # do my normal stuff at 0 indentation level

So, any thoughts?  Thanks.

To me, the obvious choice would be "return", not "break".

To me, too -- too bad it doesn't work:

c:\temp>\python32\python early_abort.py
  File "early_abort.py", line 7
    return
       ^
SyntaxError: 'return' outside function

Nor should it.  There's nothing to return out of.

--
Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/
 San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis
  There is _never_ no hope left. Remember.
   -- Louis Wu
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to