values
本頁內容尚未翻譯。
python.Codes
Section titled “python.Codes”def Codes : TypeText as Python sees it: its code points.
python.Codes.of
Section titled “python.Codes.of”def Codes.of (s : String) : CodesA string’s code points.
python.Codes.toString
Section titled “python.Codes.toString”def Codes.toString (cs : Codes) : StringThe string of the code points cs.
python.Codes.startsWith
Section titled “python.Codes.startsWith”def Codes.startsWith (head : Codes) (cs : Codes) : BoolWhether the code points cs start with the code points head.
python.Value
Section titled “python.Value”data ValueA Python value. functionValue is a function by name with its captured cells (a built-in’s name starts with
“builtin “); boundValue is a method bound to its object; notImplementedValue is NotImplemented (an operator
method declining).
python.Slot
Section titled “python.Slot”data SlotA slot of a set’s hash table: never used, used once and emptied (a dummy), or holding an item with its hash.
python.SetTable
Section titled “python.SetTable”data SetTableA set’s items: CPython’s hash table (its slots, how many hold items, how many hold items or dummies, and the
implementation’s choices its order depends on: str.hash for a str’s hash, taken as under PYTHONHASHSEED=0, and
object.address for an object’s, from the model’s addresses), or, when an item’s hash is not one the model gives, the
items in the order they were added.
python.Iterating
Section titled “python.Iterating”data IteratingWhat an iterator walks: a list (forward or backward, as the list is now), the items of a tuple, str or
reversed sequence (its type name), a range, a dict’s keys, values or items or a set (with the size they had and,
for a dict, its keys then, to notice changes), an enumerate (its iterator and the next count), or a zip (its
iterators and whether it is strict).
python.Object
Section titled “python.Object”data ObjectAn object on the heap. A dict keeps its pairs in insertion order and a set its items in a SetTable; a view is a dict’s keys,
values or items as the dict is now (its kind is its type name; it holds the dict’s address); an iterator walks what Iterating says, at a
position; an instance has its class and attributes in order, and the text __repr__ and __str__ gave before printing;
a class has its name, its method resolution order without itself, its attributes in order and the built-in
exception class it derives from (empty when none); a wrapper is a staticmethod, classmethod or property (a property’s getter and
setter, None when absent); a generator has its function, its next state, its locals while paused and whether it is
done.
python.Iterating.typeName
Section titled “python.Iterating.typeName”def Iterating.typeName (w : Iterating) : StringThe CPython type name of an iterator walking w.
python.Slot.item
Section titled “python.Slot.item”def Slot.item (slot : Slot) : List ValueThe item a slot holds, if any.
python.SetTable.items
Section titled “python.SetTable.items”def SetTable.items (t : SetTable) : List ValueThe items of the set table t in the order iterating gives them: the slots’ order, or the order they were added.
python.Names.joined
Section titled “python.Names.joined”def Names.joined (a : List String) (b : List String) : List StringThe names a followed by those of b not already in a: each once, in the order first seen.
python.SetTable.chosen
Section titled “python.SetTable.chosen”def SetTable.chosen (t : SetTable) : List StringThe implementation’s choices the order of the set table t depends on.
python.SetTable.choosing
Section titled “python.SetTable.choosing”def SetTable.choosing (t : SetTable) (more : List String) : SetTableThe set table t, its order now also depending on the choices more (built from a table that did).
python.Heap
Section titled “python.Heap”def Heap : TypeThe heap: objects by address.
python.Heap.empty
Section titled “python.Heap.empty”def Heap.empty : HeapAn empty heap.
python.Heap.object
Section titled “python.Heap.object”def Heap.object (h : Heap) (a : Nat) : Option ObjectThe object at address a on the heap h, if there is one.
python.Value.ofString
Section titled “python.Value.ofString”def Value.ofString (s : String) : ValueThe str value of the string s.
python.Value.ofDecimal
Section titled “python.Value.ofDecimal”def Value.ofDecimal (m : Nat) (e : Int) : ValueA float literal m * 10^e, correctly rounded to binary64 (0.1 is m = 1, e = -1).
python.Value.negativeZero
Section titled “python.Value.negativeZero”def Value.negativeZero : ValueNegative zero (-0.0).
python.Raised
Section titled “python.Raised”record RaisedA raised exception: the classes it is an instance of (its own first, then its bases), its message, for an
instance of a user’s class its object on the heap, the node of the statement that raised it (empty until the
statement fills it in), and its details as a verdict reports them (undeclared for a name not defined: its name;
none for an exception not structured yet).
python.Raised.named
Section titled “python.Raised.named”def Raised.named (type : String) (message : String) : RaisedA built-in exception of a type with a message, raised.
python.Raised.notDefined
Section titled “python.Raised.notDefined”def Raised.notDefined (name : String) : RaisedNameError for a name nothing defines (CPython’s message), with the name as its detail.
python.Raised.unsupportedType
Section titled “python.Raised.unsupportedType”def Raised.unsupportedType : StringThe class name of what the model cannot do (a space first, so no program’s class has it): a run stops with it and the verdict is unknown, not Python’s behavior.
python.Raised.unsupported
Section titled “python.Raised.unsupported”def Raised.unsupported (what : String) : RaisedWhat the model cannot do, described by what, raised (for example calling a user’s __eq__ while comparing
containers).
python.Raised.type
Section titled “python.Raised.type”def Raised.type (e : Raised) : StringThe own class of the raised exception e.
python.Outcome
Section titled “python.Outcome”data OutcomeWhat evaluating gives: a value, or an exception raised.
python.Outcome.raise
Section titled “python.Outcome.raise”def Outcome.raise (type : String) (message : String) : OutcomeRaising a built-in exception of a type with a message.
python.Exceptions.parent
Section titled “python.Exceptions.parent”def Exceptions.parent (type : String) : Option StringThe base of the built-in exception class type (CPython’s Objects/exceptions.c); none for BaseException.
python.Exceptions.derivesWithin
Section titled “python.Exceptions.derivesWithin”def Exceptions.derivesWithin (fuel : Nat) (type : String) (k : String) : BoolWhether the built-in exception class type is k or derives from it, within fuel steps up the hierarchy.
python.Exceptions.isSubclass
Section titled “python.Exceptions.isSubclass”def Exceptions.isSubclass (type : String) (k : String) : BoolWhether except k catches a built-in exception of a type: the type is k or derives from it (the hierarchy is
at most five deep).
python.Range.length
Section titled “python.Range.length”def Range.length (start : Int) (stop : Int) (step : Int) : NatHow many values the range from start up to stop by step gives: none when it is empty (or step is zero).
python.Value.className
Section titled “python.Value.className”def Value.className (h : Heap) (c : Value) : CodesThe name of the class value c (a built-in class’s is its name; a user’s is on the heap h).
python.Value.generatorType
Section titled “python.Value.generatorType”def Value.generatorType (function : Value) : StringA generator’s type name: a built-in generator’s is its function’s name (builtin map is a map).
python.Object.typeName
Section titled “python.Object.typeName”def Object.typeName (h : Heap) (o : Object) : StringThe type name of the object o on the heap h.
python.Value.builtinClasses
Section titled “python.Value.builtinClasses”def Value.builtinClasses : List StringThe built-ins the model has as functions that are classes in CPython (type(map) is type).
python.Value.randomMethods
Section titled “python.Value.randomMethods”def Value.randomMethods : List StringThe functions of random that are methods of its hidden Random instance written in Python (random.random and
random.getrandbits are C methods: builtin_function_or_method).
python.Value.functionType
Section titled “python.Value.functionType”def Value.functionType (name : Codes) : Stringtype(f).__name__ for the function named name (a built-in’s name starts with “builtin “): a user’s is function;
a built-in’s is type when CPython has it as a class, method for random’s Python methods, else
builtin_function_or_method.
python.Value.boundType
Section titled “python.Value.boundType”def Value.boundType (function : Value) : Stringtype(m).__name__ for the method function bound to an object: a built-in’s ([].append, a property’s setter)
is builtin_function_or_method, a user’s is method.
python.Value.typeName
Section titled “python.Value.typeName”def Value.typeName (h : Heap) (v : Value) : Stringtype(x).__name__ for the value v, looking up objects on the heap h.
python.Texts.distinct
Section titled “python.Texts.distinct”def Texts.distinct (ts : List String) : List StringThe texts ts, each once, in the order first seen.
python.Texts.joinedBy
Section titled “python.Texts.joinedBy”def Texts.joinedBy (sep : String) (ts : List String) : StringThe texts ts with sep between them.
python.Texts.union
Section titled “python.Texts.union”def Texts.union (ts : List String) : StringThe union of the type texts ts as Python’s typing writes it: each once, in the order first seen, joined by |.
python.Texts.contained
Section titled “python.Texts.contained”def Texts.contained (kind : String) (ts : List String) : StringA container’s type text: its kind with the union of its items’ types ts, or ? when it has none.
python.Pair.key
Section titled “python.Pair.key”def Pair.key (p : Value * Value) : ValueThe key of a dict’s pair p.
python.Pair.value
Section titled “python.Pair.value”def Pair.value (p : Value * Value) : ValueThe value of a dict’s pair p.
python.Value.typeText
Section titled “python.Value.typeText”def Value.typeText (fuel : Nat) (path : List Nat) (h : Heap) (v : Value) : StringThe type of the value v as Python’s typing writes it, looking up objects on the heap h: None; a list, set or
dict with the union of its items’ (keys’, values’) types, ? for none (list[?], dict[?, ?]); a tuple with each
item’s type (tuple[()] when empty); anything else its type(x).__name__. A list, set or dict inside itself (one of
the addresses on the path) is ..., and so is anything deeper than fuel levels.
python.Value.typeDepth
Section titled “python.Value.typeDepth”def Value.typeDepth : NatHow deep a type text looks into containers (Value.typeText).
python.Heap.dictAt
Section titled “python.Heap.dictAt”def Heap.dictAt (h : Heap) (a : Nat) : List (Value * Value)The pairs of the dict at address a on the heap h (none for anything else).
python.Heap.viewItems
Section titled “python.Heap.viewItems”def Heap.viewItems (h : Heap) (kind : Codes) (a : Nat) : List ValueWhat a view of the dict at address a on the heap h holds now: its keys, values or items (as 2-tuples), by the
view’s type name kind.
python.Object.truthy
Section titled “python.Object.truthy”def Object.truthy (h : Heap) (o : Object) : Boolbool(x) of the object o on the heap h: an empty list, dict, set or view is false; anything else is true.
python.Value.truthy
Section titled “python.Value.truthy”def Value.truthy (h : Heap) (v : Value) : Boolbool(x) of the value v, looking up objects on the heap h: None, False, zero, an empty str, tuple, range or
container is false; anything else is true.