Re: feature request: string.contains('...')

2010-09-24 Thread John Posner
On 9/24/2010 2:45 PM, Tim Chase wrote: On 09/24/10 13:01, Ethan Furman wrote: John Posner wrote: Another "missing feature" candidate: sublist >>> 'bc' in 'abcde' True >>> list('bc') in list('abcde') False I'm not aware of any idioms, but how about a simple function? Foldable into a one

Re: feature request: string.contains('...')

2010-09-24 Thread Tim Chase
On 09/24/10 13:01, Ethan Furman wrote: John Posner wrote: Another "missing feature" candidate: sublist >>> 'bc' in 'abcde' True >>> list('bc') in list('abcde') False I'm not aware of any idioms, but how about a simple function? def listinlist(list1, list2): "checks if

Re: feature request: string.contains('...')

2010-09-24 Thread Ethan Furman
John Posner wrote: Another "missing feature" candidate: sublist >>> 'bc' in 'abcde' True >>> list('bc') in list('abcde') False I'm not aware of any idioms, but how about a simple function? def listinlist(list1, list2): "checks if list1 is in list2" if not list1: re

Re: feature request: string.contains('...')

2010-09-24 Thread John Posner
On 9/24/2010 4:21 AM, Peter Otten wrote: If you are not interested in the position of the substr use the "in" operator: if substr in s: print "found" else: print "not found" Another "missing feature" candidate: sublist >>> 'bc' in 'abcde' True >>> list('bc') in list('abc

Re: feature request: string.contains('...')

2010-09-24 Thread Wolfgang Rohdewald
On Freitag 24 September 2010, Wim Feijen wrote: > would really like having a string.contains('...') function > which returns either True or False. I know I can mimick this > behaviour by saying string.find('...') != -1 , however, I > find this harder to read. >>> a = 'xy134' >>> '13' in a True >>

Re: feature request: string.contains('...')

2010-09-24 Thread Peter Otten
Wim Feijen wrote: > I was wondering, how to make a feature request? You can post suggestions to improve python on the python-ideas mailing list or make feature requests on the bugtracker at bugs.python.org > I would really like having a string.contains('...') function which returns > either Tru

feature request: string.contains('...')

2010-09-24 Thread Wim Feijen
Hello, I was wondering, how to make a feature request? I would really like having a string.contains('...') function which returns either True or False. I know I can mimick this behaviour by saying string.find('...') != -1 , however, I find this harder to read. string.contains('...') is easier to