[Python-3000] find -> index patch (original) (raw)
Michael Chermside mcherm at mcherm.com
Thu Aug 24 14:44:50 CEST 2006
- Previous message: [Python-3000] Droping find/rfind?
- Next message: [Python-3000] find -> index patch
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jack Diederich writes:
I make a go at doing an idiomatic convertion [...] patch attached.
WOW, I love partition. In all the instances that weren't a simple "in" test I ended up using [r]partition. In some cases one of the returned strings gets thrown away but in those cases it is guaranteed to be small. The new code is usually smaller than the old and generally clearer.
Wow. That's just beautiful. This has now convinced me that dumping [r]find() (at least!) and pushing people toward using partition will result in pain in the short term (of course), and beautiful, readable code in the long term.
If folks like the way this partial set looks I'll convert the rest.
Please do! Even if we retain [r]find(), this is still better code. And I'm personally going to stop using [r]find() in my own code starting today.
-- Michael Chermside
- Previous message: [Python-3000] Droping find/rfind?
- Next message: [Python-3000] find -> index patch
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]