On Tue, Jan 27, 2009 at 11:40 AM, "Martin v. Löwis" <mar...@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/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com