Re: shouldn't 'string'.find('ugh') return 0, not -1 ?



On Oct 31, 8:11 am, Carl Banks <pavlovevide...@xxxxxxxxx> wrote:


string.find has always been kind of a wart in Python; that's why
they're getting rid of it. For testing for the presence of a
substring, use the in operator:


Per the Python 3000 presentation given by Guido Van Rossum at
PyCon February 2007, the new Bytes type will have a "wart".

"Has some string-like methods, e.g. .find()"


.



Relevant Pages

  • Understanding "Depends: Package <= Version"
    ... It is not usually a problem to have both Python-2.3 and Python-2.4 on the same machine.  In fact, when Python gets pulled down as a dependency, it's pretty likely to happen. ... Is this a bug in apt?  If so, ... Life is too short to tolerate crappy software! ...
    (Debian-User)
  • Re: Class variable inheritance
    ... not there it checks for foo's presence in the base classes. ... I have no problem believing you guys that this is what Python ...
    (comp.lang.python)
  • Re: Pythonic way for missing dict keys
    ... It looks like Python devs have decided it is Pythonic, ... rather the mere check for the presence of one? ... (obviously since Python is still MFL), but I have to say I find this particular decision just plain stupid. ... check privately with the PEP owner first to avoid duplication). ...
    (comp.lang.python)
  • How to detect the presence of a html file
    ... Operating System: Windows ... Python version: 2.4 ... When I tried to check the presence of the bookmarks.html, I fail. ...
    (comp.lang.python)
  • Re: stripping parts of elements in a list
    ... CSUIDL PROGRAMMEr wrote: ... I am new to python. ... I am trying to get rid of '\n' after each name. ...
    (comp.lang.python)