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 larry
Recipients larry
Date 2021-04-08.11:09:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1617880169.66.0.0347480943951.issue43772@roundup.psfhosted.org>
In-reply-to
Content
The implementation of the | operator for TypeVar objects is as follows:

    def __or__(self, right):
        return Union[self, right]

    def __ror__(self, right):
        return Union[self, right]

I think the implementation of __ror__ is ever-so-slightly inaccurate.  Shouldn't it be this?

    def __ror__(self, left):
        return Union[left, self]

I assume this wouldn't affect runtime behavior, as unions are sets and are presumably unordered.  The only observable difference should be in the repr() (and only then if both are non-None), as this reverses the elements.  The repr for Union does preserve the order of the elements it contains, so it's visible to the user there.
History
Date User Action Args
2021-04-08 11:09:29larrysetrecipients: + larry
2021-04-08 11:09:29larrysetmessageid: <1617880169.66.0.0347480943951.issue43772@roundup.psfhosted.org>
2021-04-08 11:09:29larrylinkissue43772 messages
2021-04-08 11:09:29larrycreate