What is wrong in my list comprehension?

rdmurray at bitdance.com rdmurray at bitdance.com
Mon Feb 2 14:55:37 EST 2009


Quoth Stephen Hansen <apt.shansen at gmail.com>:
> 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 :)


Python 3.0 (r30:67503, Dec 18 2008, 19:09:30) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> help(''.find)
Help on built-in function find:

find(...)
    S.find(sub[, start[, end]]) -> int
    
    Return the lowest index in S where substring sub is found,
    such that sub is contained within s[start:end].  Optional
    arguments start and end are interpreted as in slice notation.
    
    Return -1 on failure.





More information about the Python-list mailing list