I really dislike the idea that when I read an expression I'd have to scan to the end of the statement to figure out if it's a forward or backward reference. Is this<div><div><br></div><div>    def foo(a, b):</div><div>

      return x * y:</div><div>        x : a + b</div><div>        y : a - b</div><div><br></div><div>really significantly better than:</div><div><br></div><div><div>    def foo(a, b):</div><div><div>      x = lambda: a + b</div>

<div>      y = lambda: a - b</div></div><div>      return x() * y()</div><div><br></div></div><div>Note that when I see the () there's an explicit marker that x and y are not simple variables so personally I wouldn't want to "save" those few characters. So really what you're doing is allowing me to put these in a different order and saving 7 characters. But I can reorder them easily enough if I want to:</div>

<div><br></div><div><div>    def foo(a, b):</div><div>      result = lambda: x() * y()</div><div><div>      x = lambda: a + b</div><div>      y = lambda: a - b</div></div><div>      return result()</div></div><div><br></div>

<div>--- Bruce<br><a href="http://www.vroospeak.com">http://www.vroospeak.com</a><br><a href="http://jarlsberg.appspot.com">http://jarlsberg.appspot.com</a><br><br>
<br><br><div class="gmail_quote">On Fri, Jun 25, 2010 at 11:48 PM, geremy condra <span dir="ltr"><<a href="mailto:debatem1@gmail.com">debatem1@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div><div></div><div class="h5">On Fri, Jun 25, 2010 at 11:55 PM, Chris Rebert <<a href="mailto:pyideas@rebertia.com">pyideas@rebertia.com</a>> wrote:<br>
> On Fri, Jun 25, 2010 at 7:58 PM, Stephen J. Turnbull <<a href="mailto:stephen@xemacs.org">stephen@xemacs.org</a>> wrote:<br>
>> Daniel DELAY writes:<br>
>><br>
>>  > (Sorry if this has already been discussed earlier on this list, I have<br>
>>  > not read all the archives)<br>
>><br>
>> I think if you search for "first-class blocks" and "lambdas", or<br>
>> similar, you'll find related discussion (although not exactly the same<br>
>> thing).  It also looks very similar to the Haskell "where", maybe<br>
>> searching for "Haskell where" would bring it up.<br>
>><br>
>>  > Renouncing to list comprehension occurs rather often when I write python<br>
>>  > code<br>
>>  ><br>
>>  > I think we could greatly improve readability if we could keep list<br>
>>  > comprehension anywhere in all cases, but when necessary explicit a too<br>
>>  > complex expression in an indented line :<br>
>>  ><br>
>>  > htmltable = ''.join( '<tr>{}</tr>'.format(htmlline) for line in table):<br>
>>  >     htmlline : ''.join( '<td>{}</td>'.format(cell) for cell in line)<br>
>><br>
>> (Edited for readability; it was munged by your mail client. ;-)<br>
>><br>
>> I'm not sure I like this better than the alternative of rewriting the<br>
>> outer loops explicitly.  But if you're going to add syntax, I think<br>
>> the more verbose<br>
>><br>
>>    htmltable = ''.join('<tr>{}</tr>'.format(htmlline) for line in table) \<br>
>>        with htmlline = ''.join('<td>{}</td>'.format(cell) for cell in line)<br>
>><br>
>> looks better.  Note that the "with" clause becomes an optional part of<br>
>> an assignment statement rather than a suite controlled by the<br>
>> assignment, and the indentation is decorative rather than syntactic.<br>
>> I considered "as" instead of "=" in the with clause, but preferred the<br>
>> "=" because that allows nested "with" in a natural way.  (Maybe, I<br>
>> haven't thought carefully about that at all.)  Obviously "with" was<br>
>> chosen because it's already a keyword.<br>
>><br>
>> I suspect this has been shot down before, though.<br>
><br>
> Prior thread:<br>
> [Python-ideas] Where-statement (Proposal for function expressions)<br>
> <a href="http://mail.python.org/pipermail/python-ideas/2009-July/005114.html" target="_blank">http://mail.python.org/pipermail/python-ideas/2009-July/005114.html</a><br>
<br>
</div></div>I was all set to dislike this syntax, but after reading over it a bit I<br>
find myself liking it a lot. Was the code for this (or similar) ever<br>
written, or was it just proposed?<br>
<font color="#888888"><br>
Geremy Condra<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div><br></div></div>