Members
- abs
- all
- any
- bool
- dict
- dir
- enumerate
- fail
- float
- getattr
- hasattr
- hash
- int
- len
- list
- max
- min
- range
- repr
- reversed
- set
- sorted
- str
- tuple
- type
- zip
abs
Parameters
all
Parameters
| Parameter | Description |
|---|---|
elements | iterable; required A collection of elements. |
any
Parameters
| Parameter | Description |
|---|---|
elements | iterable; required A collection of elements. |
bool
False if the object is None, False, an empty string (""), the number 0, or an empty collection (e.g. (), []). Otherwise, it returns True.
Parameters
| Parameter | Description |
|---|---|
x | default is False The variable to convert. |
dict
Parameters
| Parameter | Description |
|---|---|
pairs | default is [] A dict, or an iterable whose elements are each of length 2 (key, value). |
kwargs | required Dictionary of additional entries. |
dir
Parameters
| Parameter | Description |
|---|---|
x | required The object to check. |
enumerate
Parameters
| Parameter | Description |
|---|---|
list | required input sequence. |
start | int; default is 0 start index. |
fail
Parameters
| Parameter | Description |
|---|---|
msg | default is None Deprecated: use positional arguments instead. This argument acts like an implicit leading positional argument. |
attr | string; or None; default is None Deprecated. Causes an optional prefix containing this string to be added to the error message. |
sep | string; default is " " The separator string between the objects, default is space (” ”). |
stack_trace | bool; default is True If False stack trace is elided from failure for friendlier user messages |
args | required A list of values, formatted with debugPrint (which is equivalent to str by default) and joined with sep (defaults to ” ”), that appear in the error message. |
float
- If
xis already a float,floatreturns it unchanged.* Ifxis a bool,floatreturns 1.0 for True and 0.0 for False.* Ifxis an int,floatreturns the nearest finite floating-point value to x, or an error if the magnitude is too large.* Ifxis a string, it must be a valid floating-point literal, or be equal (ignoring case) toNaN,Inf, orInfinity, optionally preceded by a+or-sign.
float() returns 0.0.
Parameters
getattr
default (if specified) or raises an error. getattr(x, "foobar") is equivalent to x.foobar.
Parameters
| Parameter | Description |
|---|---|
x | required The struct whose attribute is accessed. |
name | string; required The name of the struct attribute. |
default | default is unbound The default value to return in case the struct doesn’t have an attribute of the given name. |
hasattr
x has an attribute or method of the given name, otherwise False. Example:
Parameters
| Parameter | Description |
|---|---|
x | required |
name | string; required The name of the attribute. |
hash
String.hashCode(), namely:
Parameters
| Parameter | Description |
|---|---|
value | string; required String value to hash. |
int
- If
xis already an int,intreturns it unchanged.* Ifxis a bool,intreturns 1 for True and 0 for False.* Ifxis a string, it must have the format<sign><prefix><digits>.<sign>is either"+","-", or empty (interpreted as positive).<digits>are a sequence of digits from 0 up tobase- 1, where the letters a-z (or equivalently, A-Z) are used as digits for 10-35. In the case wherebaseis 2/8/16,<prefix>is optional and may be 0b/0o/0x (or equivalently, 0B/0O/0X) respectively; if thebaseis any other value besides these bases or the special value 0, the prefix must be empty. In the case wherebaseis 0, the string is interpreted as an integer literal, in the sense that one of the bases 2/8/10/16 is chosen depending on which prefix if any is used. Ifbaseis 0, no prefix is used, and there is more than one digit, the leading digit cannot be 0; this is to avoid confusion between octal and decimal. The magnitude of the number represented by the string must be within the allowed range for the int type.* Ifxis a float,intreturns the integer value of the float, rounding towards zero. It is an error if x is non-finite (NaN or infinity).
x is any other type, or if the value is a string not satisfying the above format. Unlike Python’s int function, this function does not allow zero arguments, and does not allow extraneous whitespace for string arguments.
Examples:
Parameters
| Parameter | Description |
|---|---|
x | string; or bool; or int; or float; required The string to convert. |
base | int; default is unbound The base used to interpret a string value; defaults to 10. Must be between 2 and 36 (inclusive), or 0 to detect the base as if x were an integer literal. This parameter must not be supplied if the value is not a string. |
len
Parameters
| Parameter | Description |
|---|---|
x | iterable; or string; required The value whose length to report. |
list
Parameters
| Parameter | Description |
|---|---|
x | iterable; default is [] The object to convert. |
max
Parameters
| Parameter | Description |
|---|---|
key | callable; or None; default is None An optional function applied to each element before comparison. |
args | required The elements to be checked. |
min
Parameters
| Parameter | Description |
|---|---|
key | callable; or None; default is None An optional function applied to each element before comparison. |
args | required The elements to be checked. |
args as debug output. It will be prefixed with the string "DEBUG" and the location (file and line number) of this call. The exact way in which the arguments are converted to strings is unspecified and may change at any time. In particular, it may be different from (and more detailed than) the formatting done by str() and repr().
Using print in production code is discouraged due to the spam it creates for users. For deprecations, prefer a hard error using fail() whenever possible.
Parameters
| Parameter | Description |
|---|---|
sep | string; default is " " The separator string between the objects, default is space (” ”). |
args | required The objects to print. |
range
start to stop, using a step increment. If a single argument is provided, items will range from 0 to that element.
Parameters
| Parameter | Description |
|---|---|
start_or_stop | int; required Value of the start element if stop is provided, otherwise value of stop and the actual start is 0 |
stop | int; default is unbound optional index of the first item not to be included in the resulting list; generation of the list stops before stop is reached. |
step | int; default is 1 The increment (default is 1). It may be negative. |
repr
Parameters
| Parameter | Description |
|---|---|
x | required |
reversed
Parameters
| Parameter | Description |
|---|---|
sequence | iterable; required The iterable sequence (e.g. list) to be reversed. |
set
set() returns a new empty set.
For example,
Parameters
| Parameter | Description |
|---|---|
elements | iterable; default is [] An iterable of hashable values. |
sorted
Parameters
| Parameter | Description |
|---|---|
iterable | iterable; required The iterable sequence to sort. |
key | callable; or None; default is None An optional function applied to each element before comparison. |
reverse | bool; default is False Return results in descending order. |
str
Parameters
| Parameter | Description |
|---|---|
x | required The object to convert. |
tuple
Parameters
| Parameter | Description |
|---|---|
x | iterable; default is () The object to convert. |
type
Parameters
| Parameter | Description |
|---|---|
x | required The object to check type of. |
zip
list of tuples, where the i-th tuple contains the i-th element from each of the argument sequences or iterables. The list has the size of the shortest input. With a single iterable argument, it returns a list of 1-tuples. With no arguments, it returns an empty list. Examples:
Parameters
| Parameter | Description |
|---|---|
args | required lists to zip. |