On 5/26/2013 4:22 PM, Roy Smith wrote:
In article <mailman.2196.1369599562.3114.python-l...@python.org>,
  Terry Jan Reedy <tjre...@udel.edu> wrote:

On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote:

       if not allow_zero and abs(x) < sys.float_info.epsilon:
                  print("zero is not allowed")

The reason for the order is to do the easy calculation first and the
harder one only if the first passes.

This is a particularly egregious case of premature optimization.  You're
worried about how long it takes to execute abs(x)?  That's silly.

This is a particularly egregious case of premature response. You're ignoring an extra name lookup and two extra attribute lookups. That's silly.

That's beside the fact that one *must* choose, so any difference is a reason to act rather than being frozen like Buridan's ass.
http://en.wikipedia.org/wiki/Buridan%27s_ass

If you wish, replace 'The reason' with 'A reason'. I also the logical flow as better with the order given.





--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to