A Universe Set
grahn+nntp at snipabacken.dyndns.org
Wed Oct 4 16:47:40 CEST 2006
On Tue, 03 Oct 2006 23:13:08 -0500, Robert Kern <robert.kern at gmail.com> wrote:
> jordan.nick at gmail.com wrote:
>> Has the addition of a Universe Set object ever been suggested. Like U
>> = set(0), so that any object was a member of U?
> In : class UniverseSet(object):
> ....: def __contains__(self, x):
> ....: return True
Yes. But note that being able to write it yourself is one thing, having it
in the Standard Library and known to anyone is another.
I have been craving for some similar things for a while, and I'm still not
sure if they are good ideas, or brain damage caused by studying functional
programming at Uni. For example:
- the wildcard object, which compares equal to everything else
- infinite xrange()s
- the black hole function 'def f(*args): pass'
- the identity function 'def f(x): return x'
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.dyndns.org> R'lyeh wgah'nagl fhtagn!
More information about the Python-list