On Tue, Jan 27, 2009 at 11:40 AM, "Martin v. Löwis" <martin at v.loewis.de> wrote: >> Hm. This would change the pickling format though. Wouldn't just >> interning (short) strings on unpickling be simpler? > > Sure - that's what Jake had proposed. However, it is always difficult > to select which strings to intern - his heuristics (IIUC) is to intern > all strings that appear as dictionary keys. Whether this is good enough, > I don't know. In particular, it might intern very large strings that > aren't identifiers at all. Just set a size limit, e.g. 30 or 100. It's just a heuristic. I believe somewhere in Python itself I intern string literals if they are reasonably short and fit the pattern of an identifier; I'd worry that the pattern matching would slow down unpickling more than the expected benefit though, so perhaps just a size test would be better. -- --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