Guido van Rossum wrote: > > I wrote: > > I personally see no way to defend ('' in 'x') returning false; it's so > > clearly a substring that any definition of substring-ness that > > excludes this seems mathematically wrong, despite your good > > intentions. > > However, the backwards compatibility argument makes sense. It used to > raise an exception and it would probably break code if it stopped > doing so; longer strings are much less likely to be passed by accident > so the need for the exception there is less strong. I'm of two minds > on this now... Here's a patch: http://python.org/sf/591250 In testing this patch, I ran across this: >>> 's' in 's' True >>> 's' in 's' == True False >>> 's' in 's' is True False >>> id('s' in 's') 135246792 >>> id(True) 135246792 What's up with that? Am I missing something? Note: this occurs before the patch too. Neal
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