paul j3 <ajipa...@gmail.com> added the comment:

'type=bool' doesn't get any special treatment.  'bool' is a builtin Python 
function.

test with 

    def mybool(astr):
        print("mybool:", astr, len(astr), bool(astr))
        return bool(astr)

The trick to getting a False value is to pass a genuinely empty string.

As can be seen in several previous bug/issues, 'bool' is allowed as a type 
function, but since the only string that returns False is the empty one, it 
isn't very useful.  And we've resisted attempts give it some special treatment.

Users can write their own 'type' function that accepts language specific 
'true/false' words.  Otherwise we encourage the use of 'store_true', 
'store_false' action values.

----------

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

Reply via email to