[issue26994] unexpected behavior for booleans in argparse

2016-05-10 Thread Nathan Naze

New submission from Nathan Naze:

Setting a boolean type in argparse gives unexpected behavior when setting 
"True", "False", etc.

https://gist.github.com/nanaze/db63e3f63e318408e3223bf1245d9752

Would have expected parsing to fail for unclear input that doesn't neatly map 
to a boolean value.

--
components: Library (Lib)
messages: 265256
nosy: Nathan Naze
priority: normal
severity: normal
status: open
title: unexpected behavior for booleans in argparse
type: behavior
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue26994>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26994] unexpected behavior for booleans in argparse

2016-05-10 Thread Nathan Naze

Nathan Naze added the comment:

> It does 'bool(value)', and 'bool("False")' is True, since "False" is a 
> non-empty string.

Yes, I understand this. It's fine to mark as "working as intended", but coming 
from other flag-parsing libraries, I find the behavior unintuitive and do not 
understand the utility of accepting arbitrary strings given the  potential for 
user confusion. We uncovered this behavior debugging a script used internally 
at Google.

--

___
Python tracker 
<http://bugs.python.org/issue26994>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26994] unexpected behavior for booleans in argparse

2016-05-10 Thread Nathan Naze

Nathan Naze added the comment:

I also buy the argument that changing the behavior now would be problematic 
given the existing usages in the wild.

--

___
Python tracker 
<http://bugs.python.org/issue26994>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com