PyoSized
Bases: Checkable, Protocol
flowchart TD
pyochain.abc._collection.PyoSized[PyoSized]
pyochain.abc._mixins.Checkable[Checkable]
pyochain.abc._mixins.Checkable --> pyochain.abc._collection.PyoSized
click pyochain.abc._collection.PyoSized href "" "pyochain.abc._collection.PyoSized"
click pyochain.abc._mixins.Checkable href "" "pyochain.abc._mixins.Checkable"
Source code in pyochain/abc/_collection.pyi
33 34 35 36 37 38 39 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 | |
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
assert Dict(a=1, b=2).len() == 2
Source code in pyochain/abc/_collection.pyi
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
is_empty()
Returns True if the Collection contains no elements.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|
Example
from pyochain import Dict
d = Dict(())
assert d.is_empty()
d.insert(1, "a")
assert not d.is_empty()
Source code in pyochain/abc/_collection.pyi
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |