> Our objects are subclasses of string. Ah, those can't be interned. > >Seems to me that if the implementation of interning were > >smart enough, it would be able to drop strings that were > >not referenced from anywhere else. > > >Maybe *that* would be a useful feature to add? > > Yes. Especially if it could be made to work with subclasses of string ;) Alas, subclasses of str can't be interned. Consider the following scenario. You intern a str-subclass-instance with value "foo" that implements a funky __repr__. Some other unrelated piece of code interns the string "foo". When they apply repr() to it, they'll be very unhappy that their string has been turned into something else. (In fact, the interning code, when it sees a str-subclass-instance, makes a copy as a true str instance.) --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