[Python-ideas] 'where' statement in Python?
8mayday at gmail.com
Tue Jul 20 17:01:39 CEST 2010
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()
a*a + b*b
On Tue, Jul 20, 2010 at 6:57 PM, Andrey Popp <8mayday at gmail.com> 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 <ncoghlan at gmail.com> wrote:
>> On Tue, Jul 20, 2010 at 3:29 PM, Stephen J. Turnbull <stephen at xemacs.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 | ncoghlan at gmail.com | Brisbane, Australia
>> Python-ideas mailing list
>> Python-ideas at python.org
> Andrey Popp
> phone: +7 911 740 24 91
> e-mail: 8mayday at gmail.com
phone: +7 911 740 24 91
e-mail: 8mayday at gmail.com
More information about the Python-ideas