[Python-3000] Droping find/rfind? (original) (raw)
Fredrik Lundh fredrik at pythonware.com
Thu Aug 24 12:51:20 CEST 2006
- Previous message: [Python-3000] Droping find/rfind?
- Next message: [Python-3000] Droping find/rfind?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum wrote:
for c in ph.loggerMap.keys(): if string.find(c.parent.name, alogger.name) <> 0: alogger.parent = c.parent c.parent = alogger
This is either a really weird way of writing "if not c.parent.name.startswith(alogger.name):"
weird, indeed, but it could be a premature attempt to optimize away the slicing for platforms that don't have "startswith" (it doesn't look like a bug, afaict).
(on the other hand, "s[:len(t)] == t" is usually faster than "s.startswith(t)" for short prefixes, so maybe someone should have done a bit more benchmarking...)
(which reminds me that speeding up handling of optional arguments to C functions would be an even better use of this energy)
- Previous message: [Python-3000] Droping find/rfind?
- Next message: [Python-3000] Droping find/rfind?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]