Hi all,

As of 3.10 (PEP 604) we've gotten syntactical support for a common type
operation— namely, typing.Union[Type1, Type2] can now be written as Type1 |
Type2 . This is achieved via overriding the __or__ method.

I propose the ? symbol as sugar for typing.Optional, so that
typing.Optional[MyType] can be written as MyType? . (Yes, this is lifted
directly from C#.)

Thoughts? Is it unnecessary now that we can write MyType | None as of 3.10?

Thanks,
Will
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/VYZOMTCNSSAJNAYHRE5A5BJUMACY57SF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to