Eli Bendersky <eli...@gmail.com> added the comment:

Is it really *interesting* to trace separate parts of list comprehensions
like this? What would one want to do that? The only idea I have in mind of
perhaps for comprehensions containing 'if's, to know how many times the
comprehension was actually executed.

In any case, this indeed depends quite a lot on the internal representation
of comprehensions.

----------
Added file: http://bugs.python.org/file18888/unnamed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9315>
_______________________________________
<div dir="ltr"><br><div class="gmail_quote"><blockquote class="gmail_quote" 
style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); 
padding-left: 1ex;"><div class="im">
&gt; It looks like 3.1 with computed gotos produces the yet another different 
tracing of list comprehensions:<br>
&gt;<br>
&gt;<br>
&gt;     2: l = [i for<br>
&gt;    10:      i in<br>
&gt;     1:      range(10)]<br>
<br>
</div>Well, this kind of thing is going to depend on the exact bytecode, the<br>
way the evaluation loop is written, etc. That&#39;s why I would suggest<br>
checking that the number of traced iterations is between, e.g. 10 (since<br>
it&#39;s the number of loop iterations) and 15 (to account for any<br>
additional &quot;iterations&quot; due to various inner jumps in the 
bytecode.<br>
<div><div></div><br></div></blockquote></div><br>Is it really *interesting* to 
trace separate parts of list comprehensions like this? What would one want to 
do that? The only idea I have in mind of perhaps for comprehensions containing 
&#39;if&#39;s, to know how many times the comprehension was actually 
executed.<br>

<br>In any case, this indeed depends quite a lot on the internal representation 
of comprehensions.<br></div>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to