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

Michael Lenzen m.lenzen at gmail.com
Fri Jul 24 02:33:26 CEST 2009


-.5

You'd have to come up with an entire system for infinite sets for this 
to work, for the reasons Raymond pointed out.  You'd also have to be 
able to define what the universe is, integers, strings, strings of 
length x, etc.

-Michael Lenzen

On 07/23/2009 05:40 PM, Raymond Hettinger wrote:
> [Andy Kish]
>>     set_intersection = set.universal()
>>     for s in sets:
>>         set_intersection&= s
>
> -1 This complicates the API and the implementation for very little benefit (saving you from writing a tiny, clear helper function for an uncommon use case).
>
> Currently, sets enjoy a near zero learning curve.  That would be lost by adding set.universal() whose semantics are not immediately obvious -- for example, with s=set.universal() what is the meaning of list(s) or frozenset(s) or s.pop(); what is its repr value; and what is s^set('abc') or s-set('abc') or other operations?  You may be able to come-up with definitions that work, but those won't be intuitive to most users.
>
>
> Raymond
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas



More information about the Python-ideas mailing list