python3: 'where' keyword

Nick Coghlan ncoghlan at iinet.net.au
Sun Jan 9 12:36:18 CET 2005


Paul Rubin wrote:
> Nick Coghlan <ncoghlan at iinet.net.au> writes:
> 
>>Trying to push it a level further (down to expressions) would, IMO, be
>>a lot of effort for something which would hurt readability a lot.
> 
> 
> I think we should just try to do things in a simple and general way
> and not try to enforce readability.

Trying to embed a suite in a Python expression is anything but simple, though :)

Attaching an optional local suite to every statement can actually be done quite 
cleanly (so long as the parser is up to the job).

Doing the substitutions on the whole statement using distinct names will work 
just as well as doing the substitutions directly on the subexpressions using 
duplicate names, and moves the 'unimportant' bits after the whole thing, instead 
of sprinkling them throughout the statement.

It seems a statement based approach would be:
   1. Easier to read
   2. Less work to implement
   3. Consistent with the rest of the language
   4. Works for any statements, including compound statements

The only disadvantage relative to expression local namespaces would be that you 
would still have to watch for namespace conflicts within the statement - and I 
have grave doubts about the structure of any statement which has that problem.

If statement local namespaces were pursued, I would see expression local 
namespaces as something which hurt readability a lot without providing any new 
functionality.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list