[Python-Dev] Re: Sets: elt in dict, lst.include
Tue, 23 Jan 2001 11:43:50 -0800 (PST)
Christopher Petrilli wrote:
> The problem is that there are a lot of uses for large sets, especially
> when you begin to introduce intersections and unions.
> Unfortunately, for me, a Python implementation of Sets is only
> interesting academicaly. Any time I've needed to work with them at a
> large scale, I've needed them *much* faster than Python could achieve
> without a C extension.
On Tue, 23 Jan 2001, Ka-Ping Yee wrote:
> This proposal has the following advantages:
[six nice things about 'in dict' and 'lst.include']
I forgot to mention an important seventh advantage:
7. The list and dictionary data structures are implemented
in the C core, so we leave open the possibility of a
wizard going and optimizing the snot out of them later.
Just as there's e.g. a boundary on recursion levels before Python
invokes the cycle detection algorithm during comparison, if we
decide we need more speed for big sets, Python could notice when
a list or dictionary gets very big and invoke more powerful
optimizations. We don't have to do this now, but the important
thing is that we will always have the option to make Christopher's
dream come true. (A wizard can do this once, and every Python
script on the planet benefits.)
In general i support Python deciding on the Right Thing to do
under the hood, performance-wise, so that the programmer doesn't
have to think too hard about what data structure to choose.