Documentation
¶
Overview ¶
Package abstract ports the gating subset of cpython/Objects/abstract.c. It dispatches the object protocol (length, get/set item, numeric operations, iteration) through the type slot table in objects.
Index ¶
- Variables
- func Add(a, b objects.Object) (objects.Object, error)
- func GetItem(o, key objects.Object) (objects.Object, error)
- func Iter(o objects.Object) (objects.Object, error)
- func IterNext(it objects.Object) (objects.Object, error)
- func Length(o objects.Object) (int, error)
- func Multiply(a, b objects.Object) (objects.Object, error)
- func SetItem(o, key, value objects.Object) error
- func Subtract(a, b objects.Object) (objects.Object, error)
Constants ¶
This section is empty.
Variables ¶
var ErrTypeError = errors.New("TypeError")
ErrTypeError is the v0.2 placeholder for PyExc_TypeError. v0.3 wires up the real exception machinery.
CPython: Objects/exceptions.c:L2196 PyExc_TypeError
Functions ¶
func Add ¶
Add dispatches a + b through the numeric slots. Falls back to b's reflected slot when a returns NotImplemented.
CPython: Objects/abstract.c:L971 PyNumber_Add
func GetItem ¶
GetItem fetches o[key]. For sequence types, key must be an int. Mapping types accept any hashable key.
CPython: Objects/abstract.c:L138 PyObject_GetItem
func IterNext ¶
IterNext advances an iterator. Returns ErrStopIteration when the iterator is exhausted, mirroring PyIter_Next.
CPython: Objects/abstract.c:L2895 PyIter_Next
func Length ¶
Length returns the length of o. Tries the sequence slot first, then the mapping slot, matching PyObject_Length.
CPython: Objects/abstract.c:L48 PyObject_Length
Types ¶
This section is empty.