Author tshepang
Recipients bethard, docs@python, eric.araujo, ezio.melotti, ncoghlan, tshepang
Date 2012-03-19.14:42:00
SpamBayes Score 1.03695e-13
Marked as misclassified No
Message-id <CAA77j2B-RSMQQFJv95szwGgdot_oXp_ZoCPH3=J7x0=EPvO4hg@mail.gmail.com>
In-reply-to <1332162343.57.0.59473390537.issue14034@psf.upfronthosting.co.za>
Content
> Nick Coghlan <ncoghlan@gmail.com> added the comment:
>
> Rather than "is recommended by at least one core CPython developer" I'd say "matches the way the CPython executable handles its own verbosity argument" (check the output of "python --help")

Done.

> Also, a better fix for the non-orderable types problem is to use "default=0" when defining the verbosity arg rather than changing the test in the code.

Done.

> Finally, the "not a superset" problem that I have with the way the running example uses its verbosity argument is that it uses it to *change* the message that gets displayed, instead of using it to *display more messages* at higher verbosity levels.
>
> >From that point of view, more idiomatic usage might look something like:
>
>    if verbosity >= 2:
>        print("Running {!r}".format(self.__file__)
>    if verbosity >= 1:
>        print("Calculating {}^2".format(args.square)
>    print(answer)

Yeah, I clearly didn't understand what you meant by 'superset'. I've
added one example similar to the above.

These were good suggestions. I've attached the patch.
Files
File name Uploaded
argparse_howto3.patch tshepang, 2012-03-19.14:42:00
History
Date User Action Args
2012-03-19 14:42:02tshepangsetrecipients: + tshepang, ncoghlan, bethard, ezio.melotti, eric.araujo, docs@python
2012-03-19 14:42:00tshepanglinkissue14034 messages
2012-03-19 14:42:00tshepangcreate