tiny.python.object
Defined in tiny.python.
The package's runtime values: one tagged union that covers each kind of Python value the package supports, and a heap that owns the objects those values point to.
API (13)
Types and contracts
Public types and contracts.
Builtin: The builtin functions that the package provides, one tag each, named after the function:dict,enumerate,iter,len,list,next,range,reversedandtuple.Dict: A Python dictionary that keeps insertion order: an array of key and value entries, in the order the keys first arrived, and a hash table from each key to its entry's position.DictEntry: One key and its value in a dictionary.DictView: A live view of one dictionary.DictViewKind: The part of a dictionary a view shows, one tag each, named after the Python method that returns the view:keys,valuesanditems.Heap: The allocator and, for each kind of object, one list holding every object the virtual machine created.List: A Python list, as a Zig growable array of values.NativeMethod: A list or dictionary method bound to the object it was read from, as a tagged union with one tag per method.Range: A Python range: the integers fromstarttowardstopin steps ofstep, with the count of elements stored.Tuple: A Python tuple, as a fixed slice of values.Value: One Python value, as a tagged union of thirteen kinds.
Namespaces
Public namespaces.
heap: The heap owns every object the virtual machine creates while it runs a program: lists, tuples, dictionaries, ranges, copied strings, iterators, bound methods and dictionary views.value: Every Python value the package handles is one tagged union:None, booleans and integers are held in the value itself, a string is a slice of bytes held elsewhere, and lists, tuples, dictionaries, ranges and the other objects are pointers to objects held elsewhere.
Source
Source: lib/python/src/object/root.zig
zig
//! The package's runtime values: one tagged union that covers each kind of Python value the package//! supports, and a heap that owns the objects those values point to. A value has to be cheap to//! copy between the virtual machine's stack, its variables and its containers, and Python's rules//! for truth, equality, hashing and identity have to hold across all of the value types.//!//! The file `value` defines `Value` and the object types it points to, and the file `heap` defines//! `Heap`, which creates those objects and frees them together. The namespace re-exports `Value`,//! `Builtin`, `NativeMethod`, `List`, `Tuple`, `Dict`, `DictEntry`, `DictView`, `DictViewKind`,//! `Range` and `Heap`. The iterator types are reached through `value` alone.pub const value = @import("value.zig");pub const heap = @import("heap.zig");pub const Value = value.Value;pub const Builtin = value.Builtin;pub const NativeMethod = value.NativeMethod;pub const List = value.List;pub const Tuple = value.Tuple;pub const Dict = value.Dict;pub const DictEntry = value.DictEntry;pub const DictView = value.DictView;pub const DictViewKind = value.DictViewKind;pub const Range = value.Range;pub const Heap = heap.Heap;Source: lib/python/src/root.zig:90
zig
pub const object = @import("object/root.zig");Audit
| Definitions | 1 |
|---|---|
| Public names | 1 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |