Skip to content

Python

TODO

Syntax

# Operators

# Loops

# Lists

# Tuples

# Dictionaries

# Sets and Unions

# Iterators

# List comprehensions

# Generators

# Assertions

# Context Managers / with

# Classes / OOP

# Decorators

Type Hinting

Logging

Python has plenty of built-in functionality for logging via the logging module.

Performance and Profiling

It's always important to measure the performance of your programs when trying to isolate performance issues and/or bottlenecks. Even if you think you know all the subtle optimization going on under the hood, you may have any number of misconceptions about how your programming language is actually executing instructions on the machine. Especially for Python since it's backed by CPython many operations may already be executing fairly optimized implementations, but others may not be (think 3rd party dependencies). So, you can never be sure.

Understanding the context of your program and profiling will always beat your gut. Just measure, then you'll know.

There are several useful tools for profiling your Python programs. Some available in the standard library and some 3rd party tools.

Tool Description
Scalene A high-precision CPU, GPU, and memory profiler for python. Unfortunately also includes AI (LLM) recommendation, but they're optional.

Project Management and Virtual Environments