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/2009-March/087269.html below:

[Python-Dev] PEP 377 - allow __enter__() methods to skip the statement body

[Python-Dev] PEP 377 - allow __enter__() methods to skip the statement body [Python-Dev] PEP 377 - allow __enter__() methods to skip the statement bodyGreg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 17 01:11:57 CET 2009
Nick Coghlan wrote:
> One of the
> premises of PEP 343 was "Got a frequently recurring block of code that
> only has one variant sequence of statements somewhere in the middle?
> Well, now you can factor that out

Um, no -- it says explicitly right at the very top of
PEP 343 that it's only about factoring out try/finally
statements.

There's no way that

   try:
     code_block
   finally:
     ...

can fail to enter the code block if you get as far as
the "try". So it's not reasonable to expect the with
statement to provide this ability.

-- 
Greg
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