[Tutor] find('') returns 0

Don Jennings dfjennings at gmail.com
Mon Sep 17 01:51:00 CEST 2012

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('')

Anyone care to share a good explantion for this behavior and possible use cases? Thanks!

Take care,

More information about the Tutor mailing list