This module is the core of bytecodehacks. It contains four classes: CodeString, EditableCode, Function and InstanceMethod.
The basic idea is that each class represents an editable version of an object used by the interpreter. For example, if "code" is a Python code object, then "code.co_consts" is a tuple. If, however, it is a EditableCode object, then code.co_consts is a list. Also Python code objects have read-only attributes, which is not true of EditableCode objects.
CodeString is a bit different, and the core of the core of bytecodehacks. It represents a stream of bytecode instructions as a list of opcodes, with each opcode being an instance of a class from the ops module.
Class by class we go then.
Send comments to email@example.com