Uh oh!
There was an error while loading. Please reload this page.
Add explanation of singletons in unions to PEP484 - #240
Conversation
| else: # At this point typechecker knows that x can only have type int | ||
| return x * 2 | ||
| Since the subclasses of ``Enum`` could not be further subclassed, |
gvanrossum
commented
Jul 5, 2016
Thanks! Some language nits. I wonder if we should add another example showing an enum with multiple values? |
ilevkivskyi
commented
Jul 5, 2016
I have made corrections and added another example. I think it clarifies that it is not necessary to make many |
| token = 0 | ||
| _empty = Empty.token | ||
| def func(x: Union[int, None, Empty]=_empty) -> int: |
ilevkivskyi
commented
Jul 5, 2016
@JukkaL Done. |
By Ivan Levkivskyi (python/typing#240).
gvanrossum
commented
Jul 5, 2016
Pushed to the peps repo and filed python/mypy#1803. Maybe now that the peps repo has moved to GitHub we should switch to doing PRs there? |
ilevkivskyi
commented
Jul 5, 2016
Thanks!
Yes, I think we could switch to new peps repo. By the way, what are the plans for PEP484, will it be provisional in 3.6? Or will it "graduate" soon? |
gvanrossum
commented
Jul 5, 2016
via email
I would like PEP 484 to drop the provisional status for 3.6, but we have to
discuss this on python-dev.
For asyncio we did two provisional release (3.4 and 3.5) but IMO that was
too long (and yet not long enough -- Yury recently asked me to extend that
to 3.6 as well). |
I tried to keep discussion to a minimum, only including simple examples. I think it is better to add this section right after discussion of Optional, that is actually also a Union with a singleton type (NoneType).