Re: Implement comparison operators for range objects

2011-10-14 Thread Mark Dickinson
On Oct 12, 8:24 pm, Ian Kelly wrote: > On Wed, Oct 12, 2011 at 11:51 AM, MRAB wrote: > >> Aside: > > >> I'm astonished to see that range objects have a count method! What's the > >> purpose of that? Any value's count will either be 0 or 1, and a more > >> appropriate test would be `value in range

Re: [Python-ideas] Implement comparison operators for range objects

2011-10-13 Thread 88888 dihedral
How about iterable objects supported in python? Is a countable object iterable definitely? Also the tail recursion technique is useful for the same function with few arguments that calls itself. The lisp compiler would emit machine codes with fast jumps and passing arguments in registers or

Re: [Python-ideas] Implement comparison operators for range objects

2011-10-12 Thread Ian Kelly
On Wed, Oct 12, 2011 at 11:51 AM, MRAB wrote: >> Aside: >> >> I'm astonished to see that range objects have a count method! What's the >> purpose of that? Any value's count will either be 0 or 1, and a more >> appropriate test would be `value in range`: >> >>  >>> 17 in range(2, 30, 3) # like r.co

Re: [Python-ideas] Implement comparison operators for range objects

2011-10-12 Thread MRAB
On 12/10/2011 18:33, Steven D'Aprano wrote: Sven Marnach wrote: There are circumstances, for example in unit testing, when it might be useful to check if two range objects describe the same range. Currently, this can't be done using the '==' operator: >>> range(5) == range(5) False [...] All