Also, what about some alternative for workaround the following:
Out of Order Execution: the where clause makes execution jump around a little strangely, as the body of the where clause is executed before the simple statement in the clause header. The closest any other part of Python comes to this before is the out of order evaluation in conditional expressions.
result = let: a = retrieve_a() b = retreive_b() in: a*a + b*b
On Tue, Jul 20, 2010 at 6:57 PM, Andrey Popp firstname.lastname@example.org wrote:
PEP-3150 is awesome, just a small addition — why not to allow one-liners `where`s:
a = (b, b) where b = 43
And that also make sense for generator/list/set/dict comprehensions:
mylist = [y for y in another_list if y < 5 where y = f(x)]
On Tue, Jul 20, 2010 at 5:27 PM, Nick Coghlan email@example.com wrote:
On Tue, Jul 20, 2010 at 3:29 PM, Stephen J. Turnbull firstname.lastname@example.org wrote:
We just had a long thread about this.
The sentiment was about -0 to -0.5 on the idea in general, although a couple of people with experience in implementing Python syntax expressed sympathy for it.
For the record, I am personally +1 on the idea (otherwise I wouldn't have put so much thought into it over the years). It's just a *lot* harder to define complete and consistent semantics for the concept than people often realise.
However, having the question come up twice within the last month finally inspired me to write the current status of the topic down in a deferred PEP: http://www.python.org/dev/peps/pep-3150/
-- Nick Coghlan | email@example.com | Brisbane, Australia _______________________________________________ Python-ideas mailing list Pythonfirstname.lastname@example.org http://mail.python.org/mailman/listinfo/python-ideas
-- Andrey Popp
phone: +7 911 740 24 91 e-mail: email@example.com