Message366627
'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. |
|
Date |
User |
Action |
Args |
2020-04-16 20:23:27 | paul.j3 | set | recipients:
+ paul.j3, rhettinger, remi.lapeyre, Gharg |
2020-04-16 20:23:27 | paul.j3 | set | messageid: <1587068607.83.0.669170309799.issue40303@roundup.psfhosted.org> |
2020-04-16 20:23:27 | paul.j3 | link | issue40303 messages |
2020-04-16 20:23:27 | paul.j3 | create | |
|