[New-bugs-announce] [issue42563] max function reports type errors in incorrect order

Nicholas Kobald report at bugs.python.org
Thu Dec 3 19:57:36 EST 2020


New submission from Nicholas Kobald <nkobald at tableau.com>:

I'm not _sure_ this is a bug, but I thought the behaviour was a bit odd. If you run max with a str and an int in different orders, you get this behaviour: 

>>> max(123, 'hello')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: '>' not supported between instances of 'str' and 'int'
>>> max(123, 'hello')

>>> max('hello', 123)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: '>' not supported between instances of 'int' and 'str'

Note that order of the error message: 'int' and 'str' is the inverse of the order the str and int really are. 

Did a search for max and didn't find this.

----------
messages: 382463
nosy: nkobald
priority: normal
severity: normal
status: open
title: max function reports type errors in incorrect order
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42563>
_______________________________________


More information about the New-bugs-announce mailing list