Dies ist eine alte Version des Dokuments!
Python Strukturen
- Verzweigung – if, else
- Auswahl – match, case (ab Python 3.10, (PEP 622), PEP 634, PEP 635, PEP 636)
- Schleifen – For, while, else
- Schleifen comprehension – y = x for x = …
- Ausnahmebehandlung (Exceptions) - try/except/finally/else
- with → Klassen (Context-Manager-Konzept)
- Generatoren → yield
- Iteratoren → Klassen (Iterator-Konzept)
- Funktionen
- Funktionen: variable Anzahl Parametern f(a, *b)
- Funktionen: *args, **kwargs
- Funktionen: erzwingen von Keyword Argumenten f(a, /, b) (ab ?, PEP 457)
- Funktionen: erzwingen von Positionsargumenten f(a, /, b, *, c) (ab Python 3.8 - PEP 570)
- Funktionen: überladen
- Funktionen: Dekoratoren (Decorator)
- Funktionen: Magische Funktionen → Klassen
- Funktionen: Properties (nosetest, nose2)
- Funktionen: das '*' an Funktionsnamen
- None vs. Exception
- Module
- Module:
if __name__ == "__main__": - Module: PEP 299 – Special __main__() function in modules
- Package
- Package: Modul
__main__.pyin Paketen