> On 5 Aug 2002 at 16:50, Gordon McMillan wrote: > > > What I'm really saying is that I almost never use x > > in str because it's semantics have always been > > peculiar. Thus, I don't *really* care whether '' in > > str raises an exception, because if it does, I > > won't train myself to use it <wink>. > > Turns out that's not true. When I want set membership, > I first write "char in ('a', 'b', 'c')", then > sometimes change it because "char in 'abc'" is more > efficient. > > So whether '' in 'abc' will work or not is a red > herring. The real issue is that membership gets > conflated with subsetting. Well, in current Python you can only safely make that transformation when you're damn sure that char is a string of length one, otherwise you'd risk a TypeError. So this code (if correct) will continue to work, assuming you're not cathing TypeError (which is often an assumption when we say that a new feature "won't break old code"). --Guido van Rossum (home page: http://www.python.org/~guido/)
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