-
Context managers
__enter__and__exit__ -
decorators
- first-class citizens
- inner/nested functions behaviour
- higher order functions
- understand the OOP's design pattern
decorator patternin JAVA - closures and closures factories
- namespaces and scope in python
- understand flask decorators if you understod this so you understood decorators
def integer_validator(param_name): def decorator(func): def wrapper(*args, **kwargs): try: param_value = kwargs.get(param_name) if not param_value.isdigit(): return jsonify({'error': f'Invalid {param_name}'}), 400 return func(*args, **{param_name: int(param_value)}) except Exception as e: return jsonify({'error': str(e)}), 500 return wrapper return decorator
-
classmethod
-
typingmodule -
static method
-
@property
-
@namesetter
-
yield
-
generators
-
map,filter,reduce,enumerate,zip,counter, ...
-
lambda functions
-
advanced list comperhension
-
iterators
-
why there is no overloading in python
-
dunder methods, know them all
-
metaclasses
-
descriptors
-
dependency intection and inversion of control
-
ABC module,
@abstractmethod -
loggingmodule -
async python
-
mutabilty and immutability in python
-
argsand**kwargs -
how this syntax is possble
"DIRS": [BASE_DIR / "templates"],-
late bindingvsDuck typing -
functoolsmodule -
globalandnonlocal -
globals()in python - object introspection
-
timeitmodule - advanced usage of f-string and f-string flags
- factory methods
@classmethod
def unit_circle(cls):
"""Factory method creating a circle with radius 1"""
return cls(1)- Deeply understand python's OOP
class Circle:
def __init__(self, radius):
self.radius = radius
# mutable property
@property
def radius(self):
"""Get value of radius"""
return self._radius
@radius.setter
def radius(self, value):
"""Set radius, raise error if negative"""
if value >= 0:
self._radius = value
else:
raise ValueError("radius must be non-negative")
# immutable property
@property
def area(self):
"""Calculate area inside circle"""
return self.pi() * self.radius**2
# regular method
def cylinder_volume(self, height):
"""Calculate volume of cylinder with circle as base"""
return self.area * height
# class method
@classmethod
def unit_circle(cls):
"""Factory method creating a circle with radius 1"""
return cls(1)
# static methods
@staticmethod
def pi():
"""Value of π, could use math.pi instead though"""
return 3.1415926535-
dataclassesmodule in python - how this syntax is possible
from dataclasses import dataclass
@dataclass
class PlayingCard:
rank: str
suit: str- class decorators, how classes are presented in memory and how they're decorated!!
-
any()in python
-
is there a better way to manage dependencies other thatn
requirements.txt. Is Pipfile better that requirements.txt. -
chckout
pip-tools -
better way to manage multipe virtual environments and multiple requirements files like
requirements-dev.txtrequirements-live.txt -
how to acheive public,private,protected in python inheritance
-
what happens when you inherete from a class and what is
super().__init__()
- python's standard library documentation here
- The Python Standard Library. The Python Language Reference gives a more formal definition of the language here
- Extending and Embedding the Python Interpreter and Python/C API Reference Manual here
- copying in python Here
from dotenv import find_dotenv, load_dotenv
load_dotenv(find_dotenv(), override=True)- then to load a varialbe you simply write
import os
variable=os.getnev('VARIABLE_NAME')- Virtual Environments
- Package Management
- Modules and Packages
- Python Packaging
- _init_.py Files
- Class-based Approach
- Configuration Files
- Logging
- Version Control
- Testing
- Documentation
- Linting and Code Formatting
- IDE and Editor Integration
- Docstrings
- Module-Level Comments
- README.md
- Project Structure and Architecture
- Function and Class Usage Examples
- API Documentation
- Changelog
- Type Annotations
- Use Jupyter Notebooks for Tutorials
- Version Control and Code Hosting Platform
error
- you may encounter this error when you install requirements file
ERROR: Could not build wheels for backports.zoneinfo, which is required to install pyproject.toml-based projects
solution Edit your requirements.txt file
FROM:
backports.zoneinfo==0.2.1
TO:
backports.zoneinfo;python_version<"3.9"
- what is the difference between concurrency and multiprocessing in python. how it works in python
- if i have a file on disk and i don't 2 threads to access or write on this file at the same time, how would you handle that. how would you implement this feature yourself withoug using any python features like context managers.
- how hashing works
- can the key of the dictionary in python be any data type other than strings