[Python-Dev] PEP 326 (quick location possibility)

Aahz aahz at pythoncraft.com
Thu Jan 29 11:55:56 EST 2004

On Thu, Jan 29, 2004, Tim Peters wrote:
> Different issue.  I didn't have "a sequence".  The loop was more like:
>     global_minimum = made_up_value_presumed_to_be_unreachably_large
>     while mote_to_look_at:
>         do a ton of computation, yielding a candidate
>         if score(candidate) < global_minimum:
>             global_minimum = score(candidate)
>             do a ton of stuff to prune the search based
>                 on the new (so far) local minimum
>     return global_minimum
> It's picking the made_up_value_presumed_to_be_unreachably_large that's
> a brittle hack, and is specifically the source of the bug I mentioned.
> Adding new twists to min() wouldn't have made any difference to that.

I'm curious: why you didn't use None as the initial value or use some
other hack to avoid initializing with a specific number?
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code -- 
not in reams of trivial code that bores the reader to death."  --GvR

More information about the Python-Dev mailing list