"Easy Python": lies, damned lies, and metaclasses
- Author: Grigory Petrov, Maxim Danilov
-
https://2022.pycon.de/program/BG37DV/
-
Python often referred as simple, executable pseudocode.
- But after initial code. Develoepers welcomed with
- protocols, decorators, context managers, metaclasses and rest of the "real Python" shenanigans
What is complex code:
- Hard to understand
- Hard to maintain
- Hard to change
- Requires a lot of working memory.
Abstraction level in Python
- Function
- Class
- Module
Features in python
1. Special syntax
- Walrus Operator
- Can be complex if used with list comprehension
- Function arguments etc.
- Argument separation
- Keyword only argument
- Positional argument
- Pattern matching
2. Python data mode.s
- Has 125+ data models.
3. Scopes
- Can have different blocks
- local
- non-local
- global
- builtin
- inheritence
- MRO
- Context managers
4. Metaprogramming
- Decorators
- Metaclass
5. Dependency management
What is the solution?
- Have guidelines for project.
- Company follow strict guidelines