tuples, index method, Python's design

Paul Boddie paul at boddie.org.uk
Wed Apr 11 17:37:39 CEST 2007


On 11 Apr, 16:14, "Chris Mellon" <arka... at gmail.com> wrote:
>
> If you want a language that just adds whatever methods anyone thinks
> of, along with whatever aliases for it any can think of, to every data
> type, you know where to find Ruby.

Nobody is asking for Ruby, as far as I can see. I even submitted a
quick patch to provide tuple.index (a method that has already been
thought of), given the triviality of the solution, but you won't find
me asking for a bundle of different convenience methods with all their
aliases on every object, regardless of whether you can monkey-patch
them after the fact or not. For example:

http://www.ruby-doc.org/core/classes/Array.html#M002235

There's a pretty big chasm between wanting to be able to apply
existing functionality exactly to a type which for some reason never
acquired it and embracing the method proliferation and other low-
hanging fruit-picking seemingly popular in Ruby. In observing this,
one can make objective decisions about things like this...

http://wiki.python.org/moin/AbstractBaseClasses

Note that, in that document, index and count are methods of
MutableSequence. Quite why this should be from a conceptual
perspective is baffling, but don't underestimate the legacy influence
in such matters.

Paul




More information about the Python-list mailing list