lizardlizard <nomadicliz...@gmail.com> added the comment:

I found this bug searching after noticing weird behaviour in an error message 
saying sorted expects the reverse flag to be an integer, after it rejected 
None. This is very surprising. Why isn't it just casting the reverse parameter 
using bool() to discover it's truthyness?

In [1]: bool(None)
Out[1]: False

In [2]: sorted(['a','c','b'], reverse=None)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-45ce9ce13044> in <module>()
----> 1 sorted(['a','c','b'], reverse=None)

TypeError: an integer is required (got type NoneType)

----------
nosy: +lizardlizard

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

Reply via email to