Python context manager, generator and decorator
- Context manager
Setup and tear down action before and after some execution (e.g. open a file, database, etc.)
- Generator
syntax Sequencential operations that interleave with operation from another party (e.g. user, other library code, etc.). Related to context manager in the way that setup and tear down are interleaved with the code in between.
- Decorator
A function that returns a function
Reference: James Powell - So you want to be a Python expert, ?https://www.youtube.com/watch?v=cKPlPJyQrt4. The example that demonstrates the use of three core features in Python: generator, decorate, and context manager, is insightful!