Re: [Tutor] find('') returns 0

2012-09-16 Thread eryksun
On Sun, Sep 16, 2012 at 8:33 PM, eryksun wrote: > > The 'in' operator also searches for a substring: > > >>> '' in 'abc' > True I forgot to mention, this use of slices is a peculiarity to strings. In contrast, list.index and list.__contains__ ("in") match against individual items. An empt

Re: [Tutor] find('') returns 0

2012-09-16 Thread eryksun
On Sun, Sep 16, 2012 at 7:51 PM, Don Jennings wrote: > This behavior seems strange to me: the find method of a string returns the > position zero when you search for an empty string (granted, I can't quite > figure out why you'd search for an empty string, either). > 'abc'.find('') > 0 > >

[Tutor] find('') returns 0

2012-09-16 Thread Don Jennings
This behavior seems strange to me: the find method of a string returns the position zero when you search for an empty string (granted, I can't quite figure out why you'd search for an empty string, either). >>> 'abc'.find('') 0 Anyone care to share a good explantion for this behavior and possi