[issue14705] Add 'bool' format character to PyArg_ParseTuple*

Serhiy Storchaka report at bugs.python.org
Sat May 5 19:12:48 CEST 2012


Serhiy Storchaka <storchaka at gmail.com> added the comment:

> That's not a reason to use 'P'.  Why you should use 'P' in the first place?

I just guided by the principle "Explicit is better than implicit".
Statements 'if' and 'while' I consider explicit and expect cast to bool.
Implicit cast to bool in the transfer of parameter causes discomfort (no
one (no one Pythonist) expects the implicit cast to str). Unfortunately,
for historical reasons, there is a lot of code, where the parameters are
casted to bool or int is used instead of bool. Therefore, we cannot
simply enter the restrictions.

Well, I was certainly wrong. Don't let me mislead you.

> Anyway, what lunatic would subclass bool?

Class bool cannot be subclassed further.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14705>
_______________________________________


More information about the Python-bugs-list mailing list