PyoSized
Bases: Sized, ABC
flowchart TD
pyochain.abc._collection.PyoSized[PyoSized]
click pyochain.abc._collection.PyoSized href "" "pyochain.abc._collection.PyoSized"
Source code in src/pyochain/abc/_collection.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
is_empty()
Returns True if the Collection contains no elements.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|
Example
>>> from pyochain import Dict
>>> d = Dict(())
>>> d.is_empty()
True
>>> d.insert(1, "a")
NONE
>>> d.is_empty()
False
Source code in src/pyochain/abc/_collection.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
len()
Return the length of Self.
Equivalent to len(self), but as a method.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The number of elements in |
Example
>>> from pyochain import Dict
>>> data = Dict.from_ref({1: "a", 2: "b"})
>>> data.len()
2
Source code in src/pyochain/abc/_collection.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |