[Python-Dev] Experiences with Creating PEP 484 Stub Files (original) (raw)
Ethan Furman ethan at stoneleaf.us
Tue Feb 9 18:56:41 EST 2016
- Previous message (by thread): [Python-Dev] Experiences with Creating PEP 484 Stub Files
- Next message (by thread): [Python-Dev] Experiences with Creating PEP 484 Stub Files
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 02/09/2016 03:48 PM, Guido van Rossum wrote:
(Assuming you meant Optional.) 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
- Previous message (by thread): [Python-Dev] Experiences with Creating PEP 484 Stub Files
- Next message (by thread): [Python-Dev] Experiences with Creating PEP 484 Stub Files
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]