Peter Norvig wrote: > Let me point out that in Common Lisp, there are five equality > predicates: > > eq like Python's 'is', only true for identical objects > eql also true for numbers with same value Numbers and characters; characters as well as numbers may behave counterintuitively w.r.t EQ. > equal like Python's '==' > equalp also true for strings with different case > = only works on numbers, true if they are eql after > conversion to the same type Ha. Don't forget char= only works on characters, equivalent to EQL then char-equal only works on characters, ignores case string= only works on strings, equivalent to EQUAL then string-equal only works on strings, ignores case > I would say that Python is served well by the two equality predicates > it has, that it is impossible to please everyone, and that users > should get used to writing the predicate they want if it is not one of > the builtins. Agreed. Although the fact that EQL is much more useful in practice than EQ suggests that there's something to be said for making Python's "is" more EQL-like. (Not enough, in my opinion, to make it worth doing.) -- g
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