Tal Einat added the comment:

If I was writing a function/method with a conceptually boolean parameter 
(True/False), I wouldn't want that to accept any Python object. For example, I 
would want passing a tuple or list to raise a TypeError. But according to the 
docs[1], that's what the 'p' converter does.

If Python had a separate boolean type, this would be simple, but bool is a 
subclass of int, and it is easy to get a 0 or a 1 instead of True or False 
without noticing. So it seems reasonable when using the C API to accept an int 
when you want to get a boolean. I'd want a converter to convert it to a C bool, 
of course.

----------

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

Reply via email to