API Reference / Modules / internal / types / optional internal.types.optional Standard library Module View source class Optional @extend class Optional[T] Extends internal.core.Optional · View complete class API → Constructors 2 __new__ __new__() -> Optional[T] __new__ @overload __new__(what: T) -> Optional[T] Special methods 10 __has__ __has__(self: Self) -> bool __val__ __val__(self: Self) -> T __val_or__ __val_or__(self: Self, default: T) __bool__ __bool__(self: Self) -> bool __eq__ __eq__(self: Self, other: T) -> bool @overload __eq__(self: Self, other: Optional[T]) -> bool __ne__ __ne__(self: Self, other: T) -> bool @overload __ne__(self: Self, other: Optional[T]) -> bool __str__ __str__(self: Self) -> str __repr__ __repr__(self: Self) -> str __is_optional__ __is_optional__(self: Self, other: Optional[T]) -> bool __unwrap__ __unwrap__(self: Self) -> T alias optional optional = Optional Alias of Optional function unwrap unwrap[T: type = NoneType](opt)
class Optional @extend class Optional[T] Extends internal.core.Optional · View complete class API → Constructors 2 __new__ __new__() -> Optional[T] __new__ @overload __new__(what: T) -> Optional[T] Special methods 10 __has__ __has__(self: Self) -> bool __val__ __val__(self: Self) -> T __val_or__ __val_or__(self: Self, default: T) __bool__ __bool__(self: Self) -> bool __eq__ __eq__(self: Self, other: T) -> bool @overload __eq__(self: Self, other: Optional[T]) -> bool __ne__ __ne__(self: Self, other: T) -> bool @overload __ne__(self: Self, other: Optional[T]) -> bool __str__ __str__(self: Self) -> str __repr__ __repr__(self: Self) -> str __is_optional__ __is_optional__(self: Self, other: Optional[T]) -> bool __unwrap__ __unwrap__(self: Self) -> T