Glenn Hutchings wrote: > Simon Brunning wrote: > > It's because, philosophically, a Python tuple isn't just a read-only list. > > But there are situations where you might want to treat it as a > read-only list. E.g., an argument to a function, so that you can > guarantee the function won't modify it.
Seems to me a misplaced fear. Do you take steps to also protect other mutable arguments (dicts, class instances, etc.)? If not, there should be no reason why you should protect lists that way either. If so, you could do a similar thing for lists as well. For the record, I don't agree with tuple's absent count and index methods either, but for other reasons. It's a minor thing. I deal with it. > In that case, it makes sense > for the non-modifying methods (index() and count()) to be available. As I said in another thread, making sense is about step one out of a hundred for getting your change into the language. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list