Some
Bases: OptionType[T]
flowchart TD
pyochain.core._option.Some[Some]
pyochain.core._option.OptionType[OptionType]
pyochain.abc._mixins.Pipe[Pipe]
pyochain.core._option.OptionType --> pyochain.core._option.Some
pyochain.abc._mixins.Pipe --> pyochain.core._option.OptionType
click pyochain.core._option.Some href "" "pyochain.core._option.Some"
click pyochain.core._option.OptionType href "" "pyochain.core._option.OptionType"
click pyochain.abc._mixins.Pipe href "" "pyochain.abc._mixins.Pipe"
Option variant representing the presence of a value.
For more documentation, see the Option[T] class.
Example
from pyochain import Some
assert Some(42).pipe(repr) == "Some(42)"
assert Some("hello").pipe(repr) == "Some('hello')"
match Some(42):
case Some(value):
assert value == 42
case Null():
assert False, "This should never happen"
Source code in pyochain/core/_option.pyi
969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 | |
value
instance-attribute
Final[T]: The contained value.