Nicu Stiurca <[email protected]> added the comment:
Florent, there are several reasons I think this is a valid use case. First, for
optional arguments, '-' gets automatically replaced with '_' as the
destination. I don't see any reason why optional and positional arguments
should be treated differently when deciding the destination. This
inconveniences the programmer who could naturally be inclined to follow some
hyphenated optional arguments
a.add_argument("--option-one")
a.add_argument("--option-two")
a.add_argument("--option-three")
with hyphenated positional argument
a.add_argument("positional-args")
The programmer shouldn't have to pause and think about different naming
requirements for optional and positional arguments.
Second, persuading programmers to use underscores for positional args (eg, via
proposed documentation patch) would have user-visible changes. Specifically,
the automatically generated help/usage message would contain underscores
instead of hyphens. Admittedly, this is fairly minor and inconsequential, but
most programs use hyphens (not underscores) as delimiters in long options. I
think it would be poor form to break user expectations in this regard.
Last, I was apparently wrong (as Florent points out) that positional arguments
whose names are invalid identifiers are impossible to retrieve. That's good to
know, but that solution strikes me as just an ugly workaround. :/
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue15125>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com