Jelle Zijlstra <jelle.zijls...@gmail.com> added the comment:

I tried out 3.11 on my pyanalyze type checker and got some failures because of 
this change, because my previous trick for distinguishing between Tuple and 
Tuple[()] failed.

3.10:

>>> from typing import get_args, Tuple
>>> get_args(Tuple[()])
((),)
>>> get_args(Tuple)
()


3.11:

>>> from typing import get_args, Tuple
>>> get_args(Tuple[()])
()
>>> get_args(Tuple)
()

However, the new behavior is more consistent: get_args(tuple[()]) always 
returned (). It's also easy enough to work around (just check `... is Tuple`).

I'll put a note in the What's New for 3.11 about this change.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46981>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to