Author nstiurca
Recipients bethard, flox, mapleoin, nstiurca, r.david.murray, tshepang
Date 2012-07-08.06:50:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1341730241.26.0.983353173372.issue15125@psf.upfronthosting.co.za>
In-reply-to
Content
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. :/
History
Date User Action Args
2012-07-08 06:50:41nstiurcasetrecipients: + nstiurca, bethard, r.david.murray, flox, tshepang, mapleoin
2012-07-08 06:50:41nstiurcasetmessageid: <1341730241.26.0.983353173372.issue15125@psf.upfronthosting.co.za>
2012-07-08 06:50:40nstiurcalinkissue15125 messages
2012-07-08 06:50:39nstiurcacreate