On Wed, Jul 03, 2002 at 02:33:24AM -0700, Ka-Ping Yee wrote: > I just went on what you wrote: "No two istr instances are equal unless > they are identical." I read that to mean that == would be implemented > with pointer comparison, which would break contracts the way i described. > I see now that is not what you meant. If all dutchmen like Monty Python it doesn't mean that anyone who likes Monty Python is a dutchman. > It appears that what you are proposing is what interned string > comparison already does (since == checks for pointer equality first). But INequality checking may still require strcmp. Inverse logic again. > So, the only observable effect of the change would be to break all > code that tests for type(s) == str. Yes, that's certainly a problem. This thought experiment is part of a strange fantasy I have that Python might one day use only interned strings to represent names. There are relatively few places where a string may be converted to a name (getattr, hasattr, etc) and these could be interned at the interface if interned strings are not immortal. I expect that nothing will ever come out of this, but it's fun to think about it anyway... Oren
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