Programming Languages MOC
Hub for language features and tooling across Python, Rust, Go, Ruby and JavaScript, plus the web concepts they share. Framework-specific notes live in Django MOC and FastAPI MOC.
Core concepts
Python
- Python Double-Underscore Attributes Are Name-Mangled, Not Private: encapsulation,
_Class__attrname mangling,_attrplus@propertyinstead of getters and setters. - dir() and help() Explore Any Python Object from the REPL:
type,dir,help, dunder methods behind built-ins. - Python Polymorphism Relies on Duck Typing, Not on a Shared Parent Class: inheritance and overriding, duck typing, abstract base classes,
Protocol. - A Python Decorator Replaces a Function with Whatever It Returns: wrappers,
functools.wraps, decorator arguments, registration decorators. - Python Ignores Type Hints at Runtime, So Only a Checker or a Library Enforces Them: hint syntax, mypy vs Pydantic.
- uv run Installs a Script's Inline Dependencies in an Isolated Environment: PEP 723 script headers,
uv add --script, theuv run --scriptshebang, locking.
Rust
- Rust Variables Are Immutable Unless Declared mut:
let,let mut,const, destructuring and shadowing. - Stack Values Need a Size Known at Compile Time, Heap Values Do Not: stack vs heap,
Box<T>and ownership instead offree().
Go
- Go Has a Single Loop Keyword, for: four
forshapes,rangecopies,ifwith an init statement. - Go Methods Need a Pointer Receiver to Change Their Struct: structs, value vs pointer receivers,
&and*. - Go Interfaces Are Satisfied Implicitly by Having the Methods: no
implements, method sets, typed nil in interfaces. - A Go Slice Is a View on an Array, So append May Share or Copy Its Elements: length, capacity, aliasing; strings as bytes.
- A Go Map Returns the Zero Value for a Missing Key, So Check with comma ok:
v, ok, nil maps, random iteration order.
JavaScript & CSS
- Arrow Functions Take this from the Surrounding Scope, So They Make Poor Object Methods: lexical
this, implicit returns, callbacks in methods. - A Polyfill Adds Missing APIs at Runtime, a Transpiler Rewrites New Syntax at Build Time: Babel vs core-js, shipping only what targets need.
- box-sizing border-box Makes width Include Padding and Border: content-box vs border-box, inline elements, negative margins for full-bleed.
Web
- A REST API Exposes Resources at Endpoints and Acts on Them with HTTP Methods: resources, endpoints, safe and idempotent methods, status codes, object-level authorization.
- HTMX Swaps Server-Rendered HTML Fragments Instead of Exchanging JSON:
hx-get/hx-target/hx-swap, and escaping and CSRF for fragments. - RPC Calls a Remote Function and Waits, Messaging Hands Work to a Broker: stubs and gRPC vs queues, pub/sub and idempotent consumers.
Databases & ORMs
- An ORM Maps Classes to Tables, and Migrations Version the Schema Those Classes Describe: SQLAlchemy, N+1 queries, Alembic commands and autogenerate.
- An Inner Join Drops Rows Without a Match, a Left Join Keeps Them:
joinsvsleft_joins, row multiplication,WHEREon the right table.
Reference (05 - SOPs & Manuals/)
- Python Virtual Environments and pip Cheat Sheet:
venv,pip,pyenv, freeze pitfalls. - Rust Toolchain Cheat Sheet:
rustup,cargobuild, run, add and install. - Ruby Debugging and Bundler Cheat Sheet:
binding.irb, thedebuggem,bundle open. - Sequelize Cheat Sheet: CLI,
findByPkwith async/await, raw query and data exposure pitfalls. - Fix Binary Path Order on macOS with Homebrew and mise: making Homebrew and mise-managed runtimes win over macOS system binaries.
- Regular Expressions Cheat Sheet: syntax, Python
re, Rubygsub, Djangore_path, ReDoS. - CSS Layout and Tailwind Cheat Sheet: flow, positioning, grid, content categories, a Tailwind tooltip.
- Neovim Cheat Sheet: editor mappings and LSP.
Related maps
- Django MOC: Python web development with Django.
- FastAPI MOC: Python APIs with FastAPI.
- Software Testing MOC: testing notes across languages.
References
- Python documentation - language and standard library reference.
- The Rust Programming Language - the official Rust book.
- Go documentation - tour, Effective Go and specification.