Python Advanced Functions and Concepts
Python Advanced Functions and Concepts
print(arg)
print(f"{key}: {value}")
LEGB Rule:
- Local
- Enclosing
- Global
- Built-in
contents = [Link]()
@contextmanager
def managed_resource():
print("Setup")
yield
print("Cleanup")
Page 4: Multithreading
import threading
def worker():
print("Working")
t = [Link](target=worker)
[Link]()
[Link]()
Good for I/O-bound tasks, not CPU-bound (use multiprocessing for that).
Page 5: Useful Built-in Functions