
On Sun, Nov 16, 2008 at 9:39 PM, George Sakkis <george.sakkis@gmail.com> wrote:
George Sakkis wrote:
Using special objects to be lazy with your algorithm will never be wise.
s/lazy/elegant
To each his own, but your substitution fails to convince me that magic values are more readable than using a "valid" flag variable.
So the concept of infinity is a "magic value" and a flag variable is not ? I bet you find C-like error codes more readable than exceptions too.
Whoa, whoa, calm down, kids. I'm going -1 on this, by the way. If you come across an absolute need for this, it's likely that you're doing something wrong, and if you have namespace clashes, you're definitely doing something wrong. It's too easy to fix most of the use cases for Smallest or Largest with None, in any case: minval = None for elt in lst: if minval is None or elt < minval: minval = elt -- Cheers, Leif