why not "'in' in 'in'"?

Aahz aahz at pythoncraft.com
Thu Jun 13 19:07:50 CEST 2002

In article <aeadtt06rq at drn.newsguy.com>,
Grant Griffin  <not.this at seebelow.org> wrote:
>In article <mailman.1023978378.11084.python-list at python.org>, "Mark says...
>>def is_in(search, search_for):
>>  """Return bool indicating whether search_for is in search."""
>>  return search.find(search_for) >= 0
>That's not a bad suggestion, Mark, but if I did that I guess I would
>be forever wondering if I was testing whether the first one was in the
>second or the second one was in the first.  Again, it doesn't read
>nearly as well as:
>   if x in subject:
>       ...
>which leaves no doubt.

class myStr(str):
    def contains(self, other):
        if self.find(other) >= 0:
            return True
            return False
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"I had lots of reasonable theories about children myself, until I
had some."  --Michael Rios

More information about the Python-list mailing list