Python | Intermediate | Priority Flashcards
How to sort a dictionary by values in descending order.
Triggers name mangling when used in a class context. Enforced by the Python interpreter.
2.4 p47
Functions can be nested and they can capture and carry some of the parent function’s state with them. Functions that do this are called closures.
3.1 p67
What’s a one-sentence definition of a decorator? In what order are decorators applied?
A decorator is a callable that takes a callable as input and returns another callable. Bottom to top.
Python Tricks 3.3 The Power of Decorators
Putting a * before an iterable in a function call will do what? Putting a **?
Unpack it and pass its elements as separate positional arguments to the called function. Unpacks by matching up dictionary values and function arguments based on the dictionary keys.
Python Tricks 3.5 Function Argument Unpacking