[Patches] Re: [Patch #103693] tupleobject.c: implement tuple.index() and t
Guido van Rossum
guido@digicool.com
Sat, 24 Feb 2001 12:15:38 -0500
> Guido,
>
> are you really sure about this one ?
Yes, I am. If you have a need for using count() or index() on tuples,
you're using them the wrong way. Tuples should be used in situations
where a small record (in Pascal terms) or struct (in C terms) would be
used in other languages -- not as immutable arrays.
> The two methods here proposed relate to the constness of
> tuples (compare also with immutable_list_methods[]),
String methods were introduced for a good reason -- the introduction
of Unicode.
> and I do indeed think that their absence is a semantical
> mismatch, esp. now that strings also have methods.
I think adding these particular methods to tuples will just propagate
the misunderstanding that tuples are primarily sequences -- they're
not.
> And for the size argument - well, it's really just a few bytes
> of code.
I didn't mean code size -- I meant stuff that has to be taught,
learned, documented.
> Markus
> (author of PySol)
Thanks for PySol, Markus! It's an excellent game and has even drawn
people into learning Python!
--Guido van Rossum (home page: http://www.python.org/~guido/)