[issue16878] argparse: positional args with nargs='*' defaults to []

Chris Jerdonek report at bugs.python.org
Mon Jan 7 00:02:01 CET 2013


Chris Jerdonek added the comment:

I agree it would be very likely to break working code.  Can you elaborate on your point about 'append' though?  I'm not sure I see it.

Aside from consistency, I'm wondering if there is ever a case where it would help to return None for positional arguments.  For example, unlike with optional arguments, it doesn't seem like it would ever make sense to distinguish between the option being present and the option being present with no values (which is why const is needed in the optional case).  In other words, there is no loss of information by returning [].

----------

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


More information about the Python-bugs-list mailing list