<br><br><div class="gmail_quote">On Thu, Feb 10, 2011 at 12:01 PM, Terry Reedy <span dir="ltr"><<a href="mailto:tjreedy@udel.edu">tjreedy@udel.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
On 2/10/2011 11:52 AM, Ethan Furman wrote:<div class="im"><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Jason Swails wrote:<br>
</blockquote>
<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

How is "while n != 0:" any worse?<br>
</blockquote></blockquote>
<br></div>
1. It is redundant, just like 'if bool_value is not False:'.<br>
Python programmers should understand the null value idiom.<br>
<br>
2. It does 2 comparisons, 1 unneeded, instead of 1. For CPython,<br>
it adds 2 unnecessary bytecode instructions and takes longer.<br></blockquote><div><br>I see what you mean, and I think we're coming from different perspectives.  First I must say that the calculations I implement/use are VERY computationally demanding and code optimization is of utmost importance, so this point does not fall on deaf ears.  I agree that code optimization can be very important.  However, the only things worth *optimizing*, really, is the RDS.  Optimizing parts of the program that consume ~5% of the total operation time to run ~20% faster is only ~ 0.1% increase in total performance -- a sacrifice I'm more than willing to make for code readability (as a general philosophy).<br>
<br>These programs are also very large, collaborative efforts that necessarily have many people working on it, modifying it, etc.  It's this reason why I say that sometimes code readability trumps performance.<br><br>
</div><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">
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

It has exactly the same effect without adding any code<br>
</blockquote></blockquote>
<br></div>
Untrue, see above.<br></blockquote><div><br>What I meant was that the function result is unchanged without adding more LOC; not that it was the same on the instruction level.<br><br>I think this is just a difference of perspective: mine is almost strictly utilitarian, in that I just use languages/code/computers to solve my problems.<br>
<br><br>All the best,<br>Jason<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><font color="#888888">
<br>
<br>
<br>
-- <br>
Terry Jan Reedy</font><div><div></div><div class="h5"><br>
<br>
-- <br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Jason M. Swails<br>Quantum Theory Project,<br>University of Florida<br>Ph.D. Graduate Student<br>352-392-4032<br>