Python Interview Questions
tjreedy at udel.edu
Mon Nov 19 21:41:36 CET 2012
On 11/19/2012 9:30 AM, Roy Smith wrote:
> Our requirements are to scan the logs of a production site and filter
> down the gobs and gobs of output (we produced 70 GB of log files
> yesterday) into something small enough that a human can see what the
> most common failures were. The tool I wrote does that.
> The rest of this conversation is just silly. It's turning into getting
> hit on the head lessons.
I agree. In early Python, tuples were more different from lists than
they are today. They did not have any (public) methods. Today, they have
.index and .count methods, which make little sense from the 'tuple is a
record' viewpoint. The addition of those methods redefined tuples as
read-only (and therefore hashable) sequences.
From the collections.abc doc
Sequence | Sized, Iterable, Container |
__getitem__ __contains__, __iter__, __reversed__, index, and count
ABCs for read-only and mutable sequences.
>>> from collections.abc import Sequence
>>> issubclass(tuple, Sequence)
Terry Jan Reedy
More information about the Python-list