typing.Optional

class typing.Optional

Optional type.

Optional[X] is equivalent to Union[X, type(None)].

Note that this is not the same concept as an optional argument, which is one that has a default. An optional argument with a default needn’t use the Optional qualifier on its type annotation (although it is inferred if the default is None). A mandatory argument may still have an Optional type if an explicit value of None is allowed.

doc_python
2016-10-07 17:45:58
Comments
Leave a Comment

Please login to continue.