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-April/053112.html below:

[Python-Dev] Re: PEP 340 - possible new name for block-statement

[Python-Dev] Re: PEP 340 - possible new name for block-statement [Python-Dev] Re: PEP 340 - possible new name for block-statementNicolas Fleury nidoizo at yahoo.com
Fri Apr 29 05:21:12 CEST 2005
Guido van Rossum wrote:
> A variation on this with somewhat different semantics swaps the keywords:
> 
>     in EXPR for VAR:
>         BLOCK
> 
> If you don't need the variable, you can leave the "for VAR" part out:
> 
>     in EXPR:
>         BLOCK
> 
> Too cute? :-)
> 

I don't think it reads well.  I would prefer something that would be 
understandable for a newbie's eyes, even if it fits more with common 
usage than with the real semantics behind it.  For example a Boost-like 
keyword like:

scoped EXPR as VAR:
     BLOCK

scoped EXPR:
     BLOCK

We may argue that it doesn't mean a lot, but at least if a newbie sees 
the following code, he would easily guess what it does:

scoped synchronized(mutex):
     scoped opening(filename) as file:
         ...

When compared with:

in synchronized(mutex):
     in opening(filename) for file:
         ...

As a C++ programmer, I still dream I could also do:

scoped synchronized(mutex)
scoped opening(filename) as file
...

which would define a block until the end of the current block...

Regards,
Nicolas

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