Baptiste Carvello wrote: > Nick Coghlan a écrit : >> >> Implementing __with__ instead would give the CM complete control over >> whether or not to execute the block. >> > please note, however, that this is an important change in the semantics > of the with statement. As things are today, barring exceptional > circunstances, the body of the with statement *will* be executed > immediately. This allows to forget about the with statement when first > reading code, as it doesn't change the intent of the programmer. What > Glyph is proposing is more akin to Ruby code blocks. Yep - the idea is intriguing, powerful, and far beyond the scope of what I'm trying to achieve with PEP 377. I suspect such blocks would have to be more along the lines of what PJE suggested in order to be practical anyway (i.e. nested functions where all "local" variables were implicitly declared as nonlocal), which then leads to the question of how much of a gain they would actually provide now that you *can* explicitly declare nonlocal variables. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia ---------------------------------------------------------------
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