[Python-Dev] PEP 326 (quick location possibility) (original) (raw)
Aahz aahz at pythoncraft.com
Thu Jan 29 11:55:56 EST 2004
- Previous message: [Python-Dev] PEP 326 (quick location possibility)
- Next message: [Python-Dev] PEP 326 (quick location possibility)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Jan 29, 2004, Tim Peters wrote:
Different issue. I didn't have "a sequence". The loop was more like: globalminimum = madeupvaluepresumedtobeunreachablylarge while motetolookat: do a ton of computation, yielding a candidate if score(candidate) < globalminimum: globalminimum = score(candidate) do a ton of stuff to prune the search based on the new (so far) local minimum return globalminimum It's picking the madeupvaluepresumedtobeunreachablylarge 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
- Previous message: [Python-Dev] PEP 326 (quick location possibility)
- Next message: [Python-Dev] PEP 326 (quick location possibility)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]