*args vs **kwargs
*args captures extra positional arguments and **kwargs captures extra keyword arguments.
- args becomes tuple
- kwargs becomes dict
- Useful for flexible APIs
Quick recall
*args captures extra positional arguments and **kwargs captures extra keyword arguments.
Python exception handling is strongest when you catch specific built-in errors, use `else` for the success path, `finally` for cleanup, and custom exceptions when domain meaning matters.
`bytes` is immutable binary data, `bytearray` is mutable binary data, and `range` is a memory-efficient arithmetic sequence object.
A class defines shared behavior, each object holds instance state, `self` refers to the current instance, and `__init__` initializes it.
These helpers reduce boilerplate for grouping, counting, queue behavior, lightweight record types, partial application, reduction, and memoization.
Interview prep often comes down to comparing similar tools and explaining when each one is the better fit.
Special methods let your objects behave like built-in types in printing, indexing, length checks, and membership operations.
Python uses `if`/`elif`/`else` for general branching, a ternary expression for concise value selection, and `match-case` for structural pattern matching in newer versions.
Core Python data types include numbers, strings, lists, tuples, sets, dictionaries, booleans, and `None`.
Default argument values are evaluated once at function definition time, which makes mutable defaults a common bug source.
Python has comprehension syntax for lists, dicts, and sets, plus generator expressions for lazy pipelines.
Dictionaries map keys to values and are optimized for fast lookup, update, and membership by key.