python3: 'where' keyword

Nick Coghlan ncoghlan at iinet.net.au
Sun Jan 9 05:49:11 CET 2005


Paul Rubin wrote:
>>What would be the advantage of that over this?
>>
>>. x = sqrt(a) + sqrt(b) where:
>>.     a = 2.0
>>.     b = 3.0
> 
> 
> The idea of "where" is to allow re-using variable names instead of
> having to keep track of which ones are in use.  I just tried to give a
> very simple example of how you might do that more than once in a
> statement.

I think having to keep the names unique within the statement you are currently 
writing is a reasonable request :)

Cheers,
Nick

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



More information about the Python-list mailing list