Re: A Universe Set

2006-10-17 Thread Duncan Booth
Jorgen Grahn <[EMAIL PROTECTED]> wrote: >> >> - the wildcard object, which compares equal to everything else >> > [Paul] >> Paul> class MatchAny(object): >> Paul> def __cmp__(self,other): >> Paul> return 0 >> >> Paul> wild = MatchAny() > > FWIW, I define __eq

Re: A Universe Set

2006-10-17 Thread Jorgen Grahn
On Mon, 16 Oct 2006 09:21:11 -0500, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > [me] > >> - the wildcard object, which compares equal to everything else > [Paul] > Paul> class MatchAny(object): > Paul> def __cmp__(self,other): > Paul> return 0 > > Pau

Re: A Universe Set

2006-10-16 Thread Simon Brunning
On 10/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > You're at the mercy of the comparison machinery implemented by individual > classes. Plus, if you put a wildcard object into a set (or use it as a dictionary key) you'll confuse yourself horribly. I know I did. ;-) -- Cheers, Simon B

Re: A Universe Set

2006-10-16 Thread skip
>> - the wildcard object, which compares equal to everything else Paul> class MatchAny(object): Paul> def __cmp__(self,other): Paul> return 0 Paul> wild = MatchAny() ... You're at the mercy of the comparison machinery implemented by individual classes. Exec

Re: A Universe Set

2006-10-16 Thread Paul McGuire
"Jorgen Grahn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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. > Perhaps you could compile the submissions in this thread into an entry in the Python

Re: A Universe Set

2006-10-16 Thread Paul McGuire
> - the wildcard object, which compares equal to everything else class MatchAny(object): def __cmp__(self,other): return 0 wild = MatchAny() print wild == 1000 print 1000 == wild print wild == (1,2,3) print wild == 'abck' print wild == wild print wild != 1000 print 1000 != wild prin

Re: A Universe Set

2006-10-05 Thread hanumizzle
On 10/4/06, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Jorgen Grahn wrote: > > - 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' > > Any use cases for th

Re: A Universe Set

2006-10-05 Thread Jorgen Grahn
On Thu, 05 Oct 2006 00:02:51 +0200, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Jorgen Grahn wrote: > Any use cases for these? >> - the wildcard object, which compares equal to everything else Like someone else wrote, for quick-and-dirty comparisons or lists and dictionaries where I don'

Re: A Universe Set

2006-10-05 Thread Jorgen Grahn
On Wed, 04 Oct 2006 11:00:28 -0400, Leif K-Brooks <[EMAIL PROTECTED]> wrote: > Jorgen Grahn wrote: >> - infinite xrange()s > > itertools.count()? Oops! You're right. The itertools documentation even refers to the SML and Haskell languages. And it contains itertools.izip(), another thing on my wis

Re: A Universe Set

2006-10-05 Thread Duncan Booth
Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Jorgen Grahn wrote: >> - 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' > > Any use cases for these? > I gue

Re: A Universe Set

2006-10-04 Thread Wildemar Wildenburger
Jorgen Grahn wrote: > - 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' Any use cases for these? -- http://mail.python.org/mailman/listinfo/python-list

Re: A Universe Set

2006-10-04 Thread Istvan Albert
Jorgen Grahn wrote: > 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. This is a self correcting situation, as ayone who understands why they need this can surely write th

Re: A Universe Set

2006-10-04 Thread Peter Otten
Jean-Paul Calderone wrote: > On Wed, 04 Oct 2006 11:00:28 -0400, Leif K-Brooks <[EMAIL PROTECTED]> > wrote: >>Jorgen Grahn wrote: >>> - infinite xrange()s >> >>itertools.count()? > > Not quite: > > >>> import sys, itertools > >>> c = itertools.count(sys.maxint) > >>> c.next() > 2

Re: A Universe Set

2006-10-04 Thread Paul McGuire
"Jorgen Grahn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > - the black hole function 'def f(*args): pass' > - the identity function 'def f(x): return x' > Also not so farfetched. See the disable and enable decorators at http://wiki.python.org/moin/PythonDecoratorLibrary#head-8

Re: A Universe Set

2006-10-04 Thread MonkeeSage
Jorgen Grahn wrote: > - infinite xrange()s Fun. How about in-memory objects which use no memory, and self-referential anonymous functions, and object states without objects... Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: A Universe Set

2006-10-04 Thread Jean-Paul Calderone
On Wed, 04 Oct 2006 11:00:28 -0400, Leif K-Brooks <[EMAIL PROTECTED]> wrote: >Jorgen Grahn wrote: >> - infinite xrange()s > >itertools.count()? Not quite: >>> import sys, itertools >>> c = itertools.count(sys.maxint) >>> c.next() 2147483647 >>> c.next() -2147483648 >>>

Re: A Universe Set

2006-10-04 Thread Leif K-Brooks
Jorgen Grahn wrote: > - infinite xrange()s itertools.count()? -- http://mail.python.org/mailman/listinfo/python-list

Re: A Universe Set

2006-10-04 Thread Jorgen Grahn
On Tue, 03 Oct 2006 23:13:08 -0500, Robert Kern <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] 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 [61]: class UniverseSet(objec

Re: A Universe Set

2006-10-03 Thread Steve Holden
[EMAIL PROTECTED] 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? Maybe this gets into > some crazy Cantorian stuff since U is in U. But it seems like it would > be useful and would have a nice s

Re: A Universe Set

2006-10-03 Thread Robert Kern
[EMAIL PROTECTED] 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 [61]: class UniverseSet(object): : def __contains__(self, x): : return True : In [

A Universe Set

2006-10-03 Thread jordan . nick
Has the addition of a Universe Set object ever been suggested. Like U = set(0), so that any object was a member of U? Maybe this gets into some crazy Cantorian stuff since U is in U. But it seems like it would be useful and would have a nice symmetry with emptyset:set([]), that is: for any