8000 Add explanation of singletons in unions to PEP484 by ilevkivskyi · Pull Request #240 · python/typing · GitHub
[go: up one dir, main page]

Skip to content

Add explanation of singletons in unions to PEP484 #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 5, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Implemented style corrections
  • Loading branch information
Ivan Levkivskyi committed Jul 5, 2016
commit 0f55c3114cc506a409ed99d3102cb6d730ded879
4 changes: 2 additions & 2 deletions pep-0484.txt
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ by the standard library, so that type errors can be caught statically::
token = 0
_empty = Empty.token

def func(x: Union[int, None, Empty]=_empty) -> int:
def func(x: Union[int, None, Empty] = _empty) -> int:

boom = x * 42 # This fails type check

Expand All @@ -896,7 +896,7 @@ one value::
timeout = 1
error = 2

def process(response: Union[str, Reason]='') -> str:
def process(response: Union[str, Reason] = '') -> str:
if response is Reason.timeout:
return 'TIMEOUT'
elif response is Reason.error:
Expand Down
0