An intuitive way to annotate that variable in Python 3.8 would be:

```
events_to_do: Union[int, Literal[math.inf]] = math.inf
```

That has the advantage of matching the way you would write it now,
without changing the core language.

It unfortunately doesn't work, because PEP 586 provisionally disallows
float literals, but it may become supported in the future.

One other possible advantage of doing it this way is that you don't
have to include negative infinity (-math.inf). There are applications
where you only need positive infinity, or only need negative infinity.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/NLNO4MVCVA6KPXIXEFLM3R66UAAP5O2R/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to