[Python-ideas] Where-statement (Proposal for function expressions)

Daniel Stutzbach daniel at stutzbachenterprises.com
Thu Jul 16 17:37:34 CEST 2009


On Thu, Jul 16, 2009 at 10:06 AM, Paul Moore <p.f.moore at gmail.com> wrote:

> x[i] = 12 where:
>    i = some_complicated_expression()
>
> Was that deliberate? If so, could you explain why now, so that it's on
> record for the legions of people who will ask after it's implemented?
> :-)


Because only the right-hand side is in the where-block's scope.  If the
left-hand side were in the where-block's scope, then:

x = 0
x = i where:
   i = 5
print x

Would print "0" not "5".

--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090716/881cf968/attachment.html>


More information about the Python-ideas mailing list