Skip to main content

Reference

This pillar is the language reference. It describes the Python that gopy implements, top to bottom, with no narrative. If you want to know exactly what a token, expression, statement, builtin, or bytecode does, this is the place to look. The text is held against CPython 3.14 and divergence is a parity bug.

Sections

Language

PageCovers
Lexical analysisSource encoding, line structure, identifiers, keywords, literals, operators.
GrammarThe full PEG grammar, terminals, and soft keywords.
Data modelObjects, values, types, the standard type hierarchy.
Special methodsEvery __dunder__ slot, its signature, and when the VM calls it.
Execution modelNaming, binding, scopes, exception propagation.
Import systemPackages, search path, finders, loaders, namespace packages.
ExpressionsAtoms, primaries, operators, precedence, comprehensions, f-strings.
Simple statementsAssignment, del, return, yield, raise, import, type, ...
Compound statementsif, while, for, try, with, match, def, class, async.
Top-level componentsModules, interactive sessions, expression input.

Built-ins

PageCovers
Built-in typesEvery type in the standard hierarchy, all methods.
Built-in functionsabs, len, print, etc.; constants; classes.
Built-in exceptionsThe full exception hierarchy with rationale.

Bytecode

PageCovers
OpcodesEvery Tier-1 opcode with stack effect and oparg.

How to read these pages

  • Page layout. A short introductory paragraph, then dense tables. Tables index a feature by name and point to the source-of-record in CPython 3.14.
  • Source citations. Parser/lexer/lexer.c:1234 funcname style. Look those up in the CPython mirror.
  • Gopy status. Where gopy's implementation diverges or is partial, the diverging row is called out. See Manual -> Status for the subsystem-level picture.

Conventions

  • Bytecode names match CPython exactly. Where this page lists LOAD_FAST_BORROW, the same byte appears in gopy's compiled output.
  • Dunder names are written __name__. Slot names use CPython's tp_ / nb_ / sq_ / mp_ / am_ prefixes.
  • "Implementation defined" means the language spec gives latitude. Where gopy and CPython differ in implementation-defined behaviour, gopy still matches CPython byte-for-byte unless explicitly noted.

What is not in this pillar