python3: 'where' keyword
Sun Jan 9 01:29:17 CET 2005
"Carl Banks" <invalidemail at aerojockey.com> writes:
> > # compute sqrt(2) + sqrt(3)
> > x = (sqrt(a) where:
> > a = 2.) \
> > + sqrt (a) where:
> > a = 3.
> > Hmmm.
> 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
More information about the Python-list