break in a module

Erik Max Francis max at alcyone.com
Fri Jun 17 00:24:11 EDT 2011


Ian Kelly wrote:
> On Thu, Jun 16, 2011 at 7:21 PM, Erik Max Francis <max at alcyone.com> wrote:
>> Neither makes sense.  `break` exits out of looping structures, which the
>> top-level code of a module most certainly is not.
> 
> Why does that matter?  It seems a bit like arguing that the `in`
> keyword can't be used for membership testing, because it's already in
> use in the for-loop syntax.  It wouldn't be the first time Python has
> reused a keyword.

True.  So let's use `in` to represent breaking out of the top-level code 
of a module.  Why not, it's not the first time a keyword has been 
reused, right?

The point is, if it's not obvious already from that facetious proposal, 
it's not a good idea to reuse keywords that really read very differently 
than their original use.  Reusing `break` (or `return`) this way would 
be rather abusive.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
  San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis
   Winners are men who have dedicated their whole lives to winning.
    -- Woody Hayes



More information about the Python-list mailing list