Skip to content
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

Sentinels type annotations #105

Open
mlenzen opened this issue Aug 15, 2019 · 1 comment
Open

Sentinels type annotations #105

mlenzen opened this issue Aug 15, 2019 · 1 comment
Milestone

Comments

@mlenzen
Copy link
Owner

mlenzen commented Aug 15, 2019

Sentinels are also instances of themselves, so you can use the Sentinel as a type decorator. For example:

NOT_SET = Sentinel('not_set')
def f(arg: Union[int, None, NOT_SET] = NOT_SET):
	pass

https://stackoverflow.com/questions/10936125/python-an-object-can-be-its-own-type

@mlenzen mlenzen changed the title Sentinels are also instances of themselves Sentinels type annotations Feb 4, 2022
@mlenzen
Copy link
Owner Author

mlenzen commented Feb 4, 2022

@mlenzen mlenzen added this to the 2.1 milestone Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant