<br><br><div class="gmail_quote">On Tue, Apr 12, 2011 at 12:51 AM, Eric Snow <span dir="ltr"><<a href="mailto:ericsnowcurrently@gmail.com">ericsnowcurrently@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>Like Georg just said, the given clause seems hard to read.  He was referring to the embedded clause in the list comprehension.  I kind of feel the same way about the PEP 3150 syntax.  I remember when I was first exposed to list comprehensions.  At first it was hard because it was organized differently from any other Python code.  However, I have adjusted.  Maybe a given clause would be the same.  I'm just not sure.<br>
<div class="gmail_quote">
<div><br></div><div>That "given" after the expression keeps throwing me off.  It just looks out of place.  Would something like the following be feasible:</div><div><br></div><div>c = sqrt(a*a + b*b) given:</div>

<div>    a = retrieve_a()</div><div>    b = retrieve_b()</div><div><br></div><div>becomes:</div><div><br></div><div>given:</div><div>    a = retrieve_a()</div><div>    b = retrieve_b()</div><div>c = sqrt(a*a + b*b)</div>
<div>
<br></div><div>where the given statement is effectively _decorating_ the simple statement?  Unfortunately I am not familiar enough yet with the compiler to know what such decoration would entail, much less if it would be entirely too complicated.  However, I wanted to throw out there an alternative that is maybe more readable.  It's also one I would probably find more usable for plugging in given blocks or disabling them, much like with decorators.</div>

<div><br></div><div>I know this throws off the approach the PEP takes, but I am trying to wrap my head around how I would use statement local namespaces.  I like how it cleans up from the namespace those bits that only matter to the target statement.  It does make it easier to follow to whom those statements in the given block belong.  Anyway, this has certainly been an enlightening discussion.  I hope it bears fruit.</div>

<div><br></div><font color="#888888"><div>-eric</div></font></div></blockquote><div><br></div><div>Of course, a decorating syntax does not help with the original scenario, with embedded  given statements in list comprehensions.  But maybe that embedded syntax is too hard to read.</div>
<div><br></div><div>-eric</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">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></div><br>
</blockquote></div><br>