[Python-Dev] interning
Antoine Pitrou
solipsis at pitrou.net
Sat Oct 24 20:13:44 CEST 2009
Alexander Belopolsky <alexander.belopolsky <at> gmail.com> writes:
>
> AB> I disagree with Martin. I think interning is a set
> AB> operation and it is unfortunate that set API does not
> AB> support it directly.
>
> ML> I disagree with Alexander's last remark in several respects:
[...]
> ML> The operation "give me the member equal but not identical
> ML> to E" is conceptually a lookup operation; the mathematical set
> ML> construct has no such operation, and the Python set models
> ML> it closely. IOW, set is *not* a dict with key==value.
This looks like a debate of purity vs. practicality.
I don't have any opinion on a Python-facing API, but the interpreter's dict of
interned strings could probably converted to a set as a simple optimization.
Regards
Antoine.
More information about the Python-Dev
mailing list