[Python-Dev] Re: PEP 218 (sets); moving set.py to Lib

Magnus Lie Hetland magnus@hetland.org
Thu, 22 Aug 2002 16:24:32 +0200

Guido van Rossum <guido@python.org>:
> no hope that this will ever complete in finite time, but does that
> mean it shouldn't start?  I could write 1L<<e and avoid the issue, but
> then I'd be paying for long ops that I'll only ever need in a case
> that's only of theoretical importance.

How about lazy sets? E.g. a CartesianProduct could delegate to its two
underlying (concrete) sets when checking for membership, and a
PowerSet could perform individual member cheks for each element in a
given subset... Etc.

I guess this might be too specific for the library -- subclassing
ImmutableSet and overriding the accessors shouldn't be too hard...

(The nice thing about including it in the library is that you could
produce these things as results from operations on Set and
ImmutableSet, e.g. 2**some_set could give a power set or whatever...)

Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org