Loading topic
id(), is, and ==. It also covers the mistakes the model prevents.6 min readb = a makes two names for one list. Those ideas come from the first two chapters. Here you will learn the mechanism CPython use5 min readdel does, when __del__ runs, and what to use when you need reliable cleanup6 min readgc and weakref modules at a simple level. It covers why reference counting cannot free every object, how CPython's cyclic collector finds the rest, an6 min readsys.getsizeof reports, what i5 min readmalloc does in C. The details below describe CPython 36 min readis versus ==, and reference counts. Everything here describes CPython. The details are implementat6 min read__dict__, how classes and inheritance work, and how to measure memory with sys.getsizeof and tracemalloc. Earlier chapters covered those tools. Here you will use them to see what __slots__ saves, and you will learn what it cos5 min readsys.getsizeof and gc.collect(). It also assumes you know that CPython frees most objects through reference counting and uses a small-object allocator. You do not need to know how tracemalloc is implemented. You need to know how to use it and what6 min readtracemalloc snapshot. You should be comfortable with functions, classes, dictionaries, and decorators.5 min read