[Python-ideas] string codes & substring equality

Chris Angelico rosuav at gmail.com
Fri Nov 29 00:35:38 CET 2013


On Fri, Nov 29, 2013 at 10:29 AM, Greg Ewing
<greg.ewing at canterbury.ac.nz> wrote:
> Chris Angelico wrote:
>>
>> Would you really keep a cache of 1114112 string objects around?
>
>
> Well, not *exactly* like the int cache... the idea
> would be to remember ones that had been used, not
> pre-generate all possible 1-char strings.

That might have some value, but there'd still be cost to creating
those small strings, so it gains little and can still potentially be a
large cache. Personally, I wouldn't bother. Let 'em be like any other
string.

ChrisA


More information about the Python-ideas mailing list