> > I'm only curious if it's worth cleaning up because the OP's case is one > where there is more than one way to do it.
I just think at this point ".find" is just not the right method to use; "substring" in "string" is the way to determine what he wants is all. ".find" is useful for when you want the actual position, not when you just want to determine if there's a match at all. The way I'd clean it is to remove .find, personally :) I don't remember the outcome of their discussion on py-dev, and haven't gotten around to loading up Py3 to test it out :) I s'pose in certain contexts where catching .index's ValueError is too expensive and just checking vs -1 is faster and speed is important, .find() can still be useful. I don't do that much text parsing generally, so don't know. > However, that's not the way the world is and I suppose smarter people > have discussed this before. If there's a link to the discussion, I'd > like to read it. It's pedantic but fascinating no less. The thread I remember reading was: http://mail.python.org/pipermail/python-dev/2005-August/055704.html It sorta digressed at a certain point :) --S
-- http://mail.python.org/mailman/listinfo/python-list