[Python-Dev] Proposal to eliminate PySet_Fini

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Jun 29 22:26:41 CEST 2006


On 6/29/06, "Martin v. Löwis" <martin at v.loewis.de> wrote:
>... dict is more basic, set is just a special case of
> dict for performance reasons. Also, dict is used to define and implement
> the language itself, set is "just" a predefined type.
>
I guess it can be seen either way, just as a chicken and an egg.  Does
python-3000 still plan to integrate sets and dicts so that a set is a
view of a dict?  That would support the view that a set is more basic
(dict code will depend on set code but not the other way around).

If set has better performance than dict (which I have not noticed so
far), it will be appropriate to use it in the language implementation
where it can replace a dict.  The prime example is the "interned"
dict.

>.... What should PyDict_Fini do? Release the dummy
> object?

That and a list of free dicts.

> That can't work, and won't help.
>
Probably, but I am not arguing that PyDict_Fini is needed. Dict dummy
should be static as well and free dicts list is probably not needed in
the presence of pymalloc.

> ... It is by design that you can use the dict API everywhere, since
> dict is part of the language itself. set wasn't designed with such a
> goal (the same is true for many other types, I would guess).

That's probably the hart of my proposal.  I would like to see sets
usable as a part of the language, or an application that embeds the
language everywhere where dicts can be used today.


More information about the Python-Dev mailing list