[Tim] > I'd like to see a plausible use case for > > '' in str > > returning True, then. [Gordon McMillan] > Any code that currently does > str.find(x) >= 0 You're saying that you actually do that in cases where x may be an empty string, and that it's useful to get a True result in at least one such case? If you are saying that, it needs more details; but if you're not saying that, it's not a relevant use case. > I tend to use: > > pos = str.find(x) > if pos > -1: > > because I'm normally interested in where. Sure -- that's what .find() is for, after all. But you're also saying that your algorithms expect to search for empty strings? Like in: index = option_letter_string.find(letter) if index >= 0: list_of_option_functions[index]() else: raise UnknownOptionLetter(letter) you make sure that list_of_option_functions[0] is suitable for processing both the first option in option_letter_string and an empty "option letter"?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4