Loading topic
dict and list (key lookup, append), and know why a list cannot be a dict key. It also assumes you know how to import from the standard library. It covers how to create a Counter, how to read and change its counts, and the edge cases7 min readCounter from an iterable and read a count from it, including the fact that a missing key reads as 0. It also assumes you are comfortable with dict methods and with Python's sorted and slicing. Here you will work through the methods and operators that change 7 min readdict and list comfortably, including key lookup, append, and KeyError. It also assumes you know that dict keys must be hashable, and that you can import names from the standard library. Counter and deque are covered in 7 min readdefaultdict, passing list or int as its factory, and using it to group or count. You should also know how dict lookup works, what a KeyError is, and how to define a class with methods and inheritance.7 min readlist and dict, and import names from the standard library. Earlier chapters covered Counter and defaultdict. This one introduces deque, the container you reach for when items enter and leave at the ends of a sequence.7 min readcollections.deque that turn it from a plain double-ended queue into a tool for sliding windows and cyclic sequences. The maxlen argument limits how many items a deque holds. The rotate() method shifts items around the deque without removing any.7 min readcollections.deque and the built-in list operation by operation. You will learn where each type is fast, where it is slow, and how to decide between them with measurements instead of habit.8 min read