Michael Chermside wrote: >> 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.
note that partition provides an elegant solution to an important *subset* of all problems addressed by find/index. just like lexical scoping vs. default arguments and map vs. list comprehensions, it doesn't address all problems right out of the box, and shouldn't be advertised as doing that. </F> _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
