Jeff Knupp added the comment:

Attached a patch. Rather than altering choices or making a special check for 
string instances, I just changed the if statement to

if action.choices is not None and value not in list(action.choices):

from 

if action.choices is not None and value not in action.choices:

It has the added benefit of handling all sequence types correctly (rather than 
just strings). I tried to think of a case where this wouldn't work as expected, 
but wasn't able to.

----------
keywords: +patch
nosy: +jeffknupp
Added file: http://bugs.python.org/file28769/argparse.patch

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

Reply via email to