On 10 Apr, 15:57, Steve Holden <[EMAIL PROTECTED]> wrote: > > The point I am trying to make is that circumstances alter cases, and that we > can't always rely on our intuition to determine how specific methods > work, let alone whether they are available.
But it's telling that by adopting precisely the implementation that we currently have for lists, we can have a tuple method which does what most people would reasonably expect. "Why are we suddenly getting single characters instead of whole strings?" people have presumably exclaimed often enough, illustrating that the sequence nature of strings is a controversial topic. Lists and tuples, however, don't have such controversial baggage. > I hear the screams of "just add the index() method to tuples and have > done with it" and, to an extent, can sympathize with them. But that way > lies creeping featurism and the next thing you know we'll have a ternary > operator in the language - oh wait, we do now! Yes, but the cost of adding index to tuples is minimal, and the mental cost to programmers is arguably negative. Meanwhile, we now have to put up with the syntactic bodge that is the ternary operator until the time comes when it gets deprecated as something that didn't work out or wasn't really necessary (in Python 4000, perhaps), meaning that we now have to read third-party code more carefully, the people writing editors and tools have to change their lexers/parsers again, and so on. Paul -- http://mail.python.org/mailman/listinfo/python-list