[Python-ideas] universal set object for use in set manipulation

Terry Reedy tjreedy at udel.edu
Thu Jul 23 23:06:56 CEST 2009


Terry Jones wrote:
> See also this thread:
> 
>   http://mail.python.org/pipermail/python-dev/2006-May/064977.html
> 
> I implemented some of what I was proposing there (in Python though, not C),
> and am happy to send people the code if there's any interest.
> 
> These things can't be 100% clean (e.g., what happens when you call len on
> an infinite set), but you can still get a lot of useful functionality if
> what's provided matches your use case. Having efficient support for very
> large sets via complements, having a Universal set, etc., would all be nice.
> 
> Anyway, see the above thread for more discussion / opinions.

Did you register a module with PyPI?

In any case, it seems to me that adding a 'universal set' to the set 
class does not work.  On the otherhand, a separate set-complement class 
(which I am guessing is what you did) should work fine as far as it 
goes. Each instance would have normal set as its data member, and 
operations on complements and mixed operations would be defined in terms 
of operations on sets. A universal set would then be an instance with an 
empty set for a complement. I think the OP should look in this 
direction, possibly building on your existing code.

Terry Jan Reedy





More information about the Python-ideas mailing list