This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients Dominik V., docs@python, gvanrossum, kj, levkivskyi
Date 2020-11-11.18:10:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605118205.31.0.640864053494.issue42317@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-11-11 18:10:05gvanrossumsetrecipients: + gvanrossum, docs@python, levkivskyi, Dominik V., kj
2020-11-11 18:10:05gvanrossumsetmessageid: <1605118205.31.0.640864053494.issue42317@roundup.psfhosted.org>
2020-11-11 18:10:05gvanrossumlinkissue42317 messages
2020-11-11 18:10:05gvanrossumcreate