A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-May/053343.html below:

[Python-Dev] PEP 340: Breaking out.

[Python-Dev] PEP 340: Breaking out. [Python-Dev] PEP 340: Breaking out.Rodrigo Dias Arruda Senra rodsenra at gpr.com.br
Wed May 4 21:24:10 CEST 2005
[ Shane Hathaway ]:
> I'd like to suggest a small language enhancement that would fix this
> example.  Allow the break and continue statements to use a keyword,
> either "for" or "while", to state that the code should break out of both
> the block statement and the innermost "for" or "while" statement.  The
> example above would change to:
> 
>     for name in filenames:
>         opening(name) as f:
>             if f.read(2) == 0xFEB0:
>                 break for
> 
> This could be a separate PEP if necessary.  When a "break for" is used
> in a block statement, it should raise a new kind of exception,
> BreakForLoop, and the block statement should propagate the exception.
> When used outside a block statement, "break for" can use existing Python
> byte code to jump directly to the next appropriate statement.

 What about nested blocks ? When they act as iterators that would be
 desireable too.

 What to do then: 

  - baptize blocks  -> break <name>
  - keep them anonymous ->  break #enclosing_scope_counter
  - do not support them 

 cheers,
 Senra

-- 
Rodrigo Senra                 
--
MSc Computer Engineer    rodsenra(at)gpr.com.br  
GPr Sistemas Ltda        http://www.gpr.com.br/ 
Personal Blog     http://rodsenra.blogspot.com/

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4