Guido van Rossum <gu...@python.org> added the comment:

Agreed it's mildly sad, and I wish the cache could preserve the order in 
List[Union[int, str]], but for that to work we'd have to change how the cache 
works, which feels complex, or we'd have to chance things so that Union[int, 
str] != Union[str, int], which seems wrong as well (and we've had them equal 
for many releases so this would break code).

Fixing the cache would require adding a new comparison method to all generic 
type objects, and that just doesn't seem worth the effort (but I'd be open to 
this solution in the future).

So for now, let's document that get_args() may swap Union arguments.

----------
stage:  -> needs patch

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

Reply via email to