<font color='black' size='2' face='arial'><br>

<div style="font-size: 10pt; color: black;"><font face="arial, helvetica">Stephen Turnbull writes:</font><br>
<br>




<div id="AOLMsgPart_0_402ed29f-7058-4ae9-be37-96faab5caa79" style="margin: 0px; font-size: 12px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">

<pre style="font-size: 9pt;"><tt><font face="Arial, Helvetica, sans-serif"> ></font><font face="Tahoma, Verdana, Arial, sans-serif">Shane Green writes:

 >> List comprehensions are concise, intuitive, and efficient; proper
 >> use can improve readability *and* performance significantly.

>Truth, the whole truth, and nothing but the truth.

 >> The number of proper applications is limited by list comprehension
 >> limitations.

>Truth, but not the whole truth.

 >> Adding the ability to configure termination in the comprehension
 >> will increase that number.

>Not necessarily.  In fact, any programming construct is limited by
>*human* comprehension limitations.  As has been pointed out by people
>who think about these issues deeply and push these constructs to their
>limits, *because* a comprehension[1] is an *expression*, nested
>comprehensions (nested in higher-level expressions) are possible.
>Adding clauses to the construct increases the complexity, and
>comprehensions are already pretty complex.[2]

>Personally, *because* iterables can be infinite, I think the lack of a
>stop clause in comprehensions is ugly and adds some unobvious
>complexity to comprehensions and displays.  The programmer needs to
>also keep in mind the possibility that some iterables are infinite,
>and deal with that.  The convenience value of an internal
>"takewhile()" is also undeniable.  I'd like to see the feature added.

>But I definitely see this as a tradeoff, and I don't know how costly
>the increased complexity of comprehensions would be to folks who push
>the limits of comprehension usage already.  Increased complexity in
>the basic construct might push them over the limit, and they would
>*decrease* usage.[3]  Nick et al clearly are concerned about that end
>of the spectrum, and I personally would place those needs over mine in
>this case.  (YMMV, that's just my opinion about *me*.)


>Footnotes:</font></tt></pre><pre style="font-size: 9pt;"><tt><font face="Tahoma, Verdana, Arial, sans-serif"><deleted></font></tt></pre><pre style="font-size: 9pt;"><span style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 9pt;">The takewhile syntax is kind of god awful.  The lambda thing always gives</span></pre><pre style="font-size: 9pt;"><span style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 9pt;">me pause, though I now 'grok' the whole thing to be a conditional.</span></pre><pre style="font-size: 9pt;"><font face="Tahoma, Verdana, Arial, sans-serif">I don't think the issue is about added complexity to the comprehension</font></pre><pre style="font-size: 9pt;"><font face="Tahoma, Verdana, Arial, sans-serif">(as the added clause would be optional anyway) but the twists and turns</font></pre><pre style="font-size: 9pt;"><font face="Tahoma, Verdana, Arial, sans-serif">needed internally to get it working, and the open question about whether</font></pre><pre style="font-size: 9pt;"><font face="Tahoma, Verdana, Arial, sans-serif">the syntactical implications can be adequately 'contained'.  </font></pre><pre style="font-size: 9pt;"><br>
</pre>
</div>
 <!-- end of AOLMsgPart_0_402ed29f-7058-4ae9-be37-96faab5caa79 -->



</div>
</font>