Comment on PEP-0322: Reverse Iteration Methods

David Abrahams dave at boost-consulting.com
Fri Sep 26 20:41:08 EDT 2003


Stephen Horne <$$$$$$$$$$$$$$$$$@$$$$$$$$$$$$$$$$$$$$.co.uk> writes:

> On Fri, 26 Sep 2003 14:51:05 -0400, David Abrahams
> <dave at boost-consulting.com> wrote:
>
>>Alex Martelli <aleax at aleax.it> writes:
>>
>>> David Abrahams wrote:
>>>    ...
>>>> Also, the idea of denying tuples the ability to reverse iterate seems
>>>> arbitrary and capricious.
>>>
>>> Sure, but so is denying them, e.g., non-mutating methods such as
>>> .index() and .count().
>>
>>Not IMO. Immutability is a very useful trait.
>
> Yes - and perfectly consistent with having *NON*-mutating methods such
> as .index() and .count()  ;-)

Right.  Oops, I misread.

> I always assumed that these were considered inconsistent with normal
> use of tuples (which certainly I rarely need to get 'index' or
> 'count'-like results from).

I don't see why not.

> Actually, they even seem a little odd in list, to be honest. I'd have
> functions, not necessarily even in __builtins__, which work on any
> sequence. They just don't seem like everyday operations that should be
> built into the object.

It's probably just for optimization purposes.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Python-list mailing list