You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/DerivationTree.md
+12-3Lines changed: 12 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -181,19 +181,22 @@ Invoking methods (`<SYMBOL>.METHOD()`), as well as operators (say, `<SYMBOL> + .
181
181
Since any `<SYMBOL>` has the type `DerivationTree`, one must convert it first into a standard Python type before passing it as argument to a standard Python function.
182
182
183
183
`str(<SYMBOL>) -> str`
184
-
: Convert `<SYMBOL>` into a Unicode string. If `<SYMBOL>` is a byte string, its contents are converted using `latin-1` encoding.
184
+
: Convert `<SYMBOL>` into a Unicode string. Byte strings in `<SYMBOL>` are converted using `latin-1` encoding.
185
+
186
+
`bytes(<SYMBOL>) -> bytes`
187
+
: Convert `<SYMBOL>` into a byte string. Unicode strings in `<SYMBOL>` are converted using `utf-8` encoding.
185
188
186
189
`int(<SYMBOL>) -> int`
187
190
: Convert `<SYMBOL>` into an integer, like the Python `int()` function.
188
191
`<SYMBOL>` must be an `int`, or a Unicode string or byte string representing an integer literal.
189
192
190
193
`float(<SYMBOL>) -> float`
191
194
: Convert `<SYMBOL>` into a floating-point number, like the Python `float()` function.
192
-
`<SYMBOL>` must be an int, or a Unicode string or byte string representing a float literal.
195
+
`<SYMBOL>` must be an `int`, or a Unicode string or byte string representing a float literal.
193
196
194
197
`complex(<SYMBOL>) -> complex`
195
198
: Convert `<SYMBOL>` into a complex number, like the Python `complex()` function.
196
-
`<SYMBOL>` must be an int, or a Unicode string or byte string representing a float literal.
199
+
`<SYMBOL>` must be an `int`, or a Unicode string or byte string representing a float or complex literal.
197
200
198
201
`bool(<SYMBOL>) -> bool`
199
202
: Convert `<SYMBOL>` into a truth value:
@@ -276,6 +279,12 @@ Each element of the list can have a different type, depending on the type the `v
276
279
: Return the parent of the current node, or `None` for the root node.
277
280
278
281
282
+
### Accessing Sources
283
+
284
+
`<SYMBOL>.sources() -> list[DerivationTree]`
285
+
: Return a list containing all sources of `<SYMBOL>`. Sources are symbols used in generator expressions out of which the value of `<SYMBOL>` was created; see [the section on data conversions](sec:conversion) for details.
0 commit comments