[Python-Dev] Experiences with Creating PEP 484 Stub Files
Ethan Furman
ethan at stoneleaf.us
Tue Feb 9 18:56:41 EST 2016
On 02/09/2016 03:48 PM, Guido van Rossum wrote:
> (Assuming you meant Option*al*.) There seems to be an utter confusion
> of the two uses of the term "optional" here. An "optional argument"
> (outside PEP 484) is one that has a default value. The "Optional[T]"
> notation in PEP 484 means "Union[T, None]". They mean different
> things.
In an effort to be (crystal) clear:
option argument in Python: has a default value, so may be omitted when
the function is called.
Optional[T] in MyPy: the argument has no default value, and must be
supplied when the function is called, but the argument can be None.
--
~Ethan~
More information about the Python-Dev
mailing list