On Sat, Mar 23, 2019 at 11:00 AM Stefan Krah <sk...@bytereef.org> wrote:

> On Sat, Mar 23, 2019 at 10:37:43AM -0700, Gregory P. Smith wrote:
> > A useless statement like that isn't likely to be typed.  I've never seen
> > anyone do that.
>
> Unlikely yes, but ideally type annotations should not alter program
> behavior:
>
> >>> d = {}
> >>> try: d["x"]
> ... except KeyError: print("KeyError")
> ...
> KeyError
> >>>
> >>> d = {}
> >>> try: d["x"] : int
> ... except KeyError: print("KeyError")
> ...
>

Unfortunately that isn't what PEP 526 said:
https://www.python.org/dev/peps/pep-0526/#annotating-expressions

-gps
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to