why not "'in' in 'in'"?
Aahz
aahz at pythoncraft.com
Thu Jun 13 13:07:50 EDT 2002
More information about the Python-list mailing list
Thu Jun 13 13:07:50 EDT 2002
- Previous message (by thread): why not "'in' in 'in'"?
- Next message (by thread): why not "'in' in 'in'"?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 else: 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
- Previous message (by thread): why not "'in' in 'in'"?
- Next message (by thread): why not "'in' in 'in'"?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list