This project was started to bring together useful Python code snippets that make coding faster, easier, and more enjoyable. You can explore all the cheat sheets at Pysheeet. Contributions are always welcome—feel free to fork the repo and submit a pull request to help it grow!
This part only provides a quick glance at some important features in Python 3. If you're interested in all of the most important features, please read the official document, What’s New in Python.
Core Python fundamentals including data types, functions, classes, and commonly used patterns for everyday programming tasks.
- From Scratch
- Future
- Typing
- Class
- Function
- Unicode
- List
- Set
- Dictionary
- Heap
- Generator
- Regular expression
Date/time handling, file I/O, and operating system interfaces.
- Datetime - Timestamps, formatting, parsing, timezones, timedelta
- Files and I/O - Reading, writing, pathlib, shutil, tempfile
- Operating System - Processes, environment, system calls
Threading, multiprocessing, and concurrent.futures for parallel execution. Covers synchronization primitives, process pools, and bypassing the GIL.
- Threading - Threads, locks, semaphores, events, conditions
- Multiprocessing - Processes, pools, shared memory, IPC
- concurrent.futures - Executors, futures, callbacks
Asynchronous programming with Python's asyncio module. Covers coroutines,
event loops, tasks, networking, and advanced patterns.
- A Hitchhiker's Guide to Asynchronous Programming - Design philosophy and evolution
- Asyncio Basics - Coroutines, tasks, gather, timeouts
- Asyncio Networking - TCP/UDP servers, HTTP, SSL/TLS
- Asyncio Advanced - Synchronization, queues, subprocesses
Native extensions for performance-critical code. Covers modern pybind11 (used by PyTorch, TensorFlow), ctypes, cffi, Cython, and the traditional Python C API. Also includes a guide for Python developers learning modern C++ syntax.
- ctypes - Load shared libraries without compilation
- Python C API - Traditional C extension reference
- Modern C/C++ Extensions - pybind11, Cython
- Learn C++ from Python - Modern C++ for Python developers
Modern cryptographic practices and common security vulnerabilities. Covers encryption, TLS/SSL, and why legacy patterns are dangerous.
- Modern Cryptography - AES-GCM, RSA-OAEP, Ed25519, Argon2
- TLS/SSL and Certificates - HTTPS servers, certificate generation
- Common Vulnerabilities - Padding oracle, injection, timing attacks
Low-level network programming with Python sockets. Covers TCP/UDP communication, server implementations, asynchronous I/O, SSL/TLS encryption, and packet analysis.
Database access with SQLAlchemy, Python's most popular ORM. Covers connection management, raw SQL, object-relational mapping, and common query patterns.
Deep learning with PyTorch and distributed training on HPC clusters. Covers tensor operations, neural networks, and job scheduling with Slurm.
Supplementary topics covering Python internals, debugging techniques, and language features that don't fit elsewhere.
$ virtualenv venv
$ . venv/bin/activate
$ pip install -r requirements.txt
$ make
$ python app.py
# URL: localhost:5000