On 2006-07-18, Paul Boddie <[EMAIL PROTECTED]> wrote: > John Machin wrote: >> >> range() and xrange() are functions. You are suggesting that 2 >> *functions* should acquire a __contains__ method each? I trust >> not. > > Well, range is a function in the current implementation, > although its usage is similar to that one would get if it were > a class, particularly a subclass of list or one providing a > list-style interface. With such a class, you could provide a > __contains__ method which could answer the question of what > the range contains based on the semantics guaranteed by a > range (in contrast to a normal list). > >> Perhaps you meant that the acquisitors should be the objects >> that those functions return. > > The whole point was to avoid expanding the range into a list.
It's unclear what you're referring to as "the range". Perhaps you're thinking of a slice? Somethign like if (0:10000).contains(x): -- Grant Edwards grante Yow! Make me look like at LINDA RONSTADT again!! visi.com -- http://mail.python.org/mailman/listinfo/python-list