[Python-ideas] Show more info when `python -vV`

Chris Angelico rosuav at gmail.com
Mon Oct 17 01:51:59 EDT 2016


On Mon, Oct 17, 2016 at 3:21 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 17 October 2016 at 13:40, Chris Angelico <rosuav at gmail.com> wrote:
>> On Mon, Oct 17, 2016 at 2:33 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>>> While it *is* a little unusual to implement it that way, I don't think
>>> that's sufficient reason to break with the established output format
>>> for the plain "-V".
>>
>> Seems reasonable. Minor point: I'd be forever having to check whether
>> it's -vV, -Vv, or -VV
>
> If we use the normal verbose flag, then both "-vV" and "-Vv" will
> work, since options can be provided in any order.

That's a good start, at least.

> I don't think it makes sense to also allow "-VV" - we're not
> requesting the version twice, we're asking for more verbose version
> information.

It's not as far-fetched as you might think - if "vv" means "more
verbose", and "qq" means "more quiet", then "VV" means "more version
info". It's a form of word doubling for emphasis, a tradition that
dates back at least as far as ancient Hebrew, and has some currency in
English. And if -VV has no other meaning, it's not going to hurt to
accept it as an alias for -Vv, right? Remember, this option isn't only
for the expert - it's also for the novice, who might be typing at the
dictation of someone else ("can you tell me what python -vV says,
please? -- no, that's one capital V and one small v -- no no, not both
capital, just one"). But if it can't be done, so be it. At least with
them being independent flags, the order doesn't matter.

> Since "-v" is already a counted option, we're also free
> to expand it to give even more info the more verbose we ask it to be
> (although initially I think pursuing just Inada-san's main suggestion
> of matching the REPL header makes sense)

Sure, I guess. Not sure what -Vvv would mean, but okay. The same could
easily be done with -VVV though, just by making -V a counted option.
Logic could simply be:

if Version:
    # Count verbosity based on -v and/or -V
    Version += verbose
    if Version >= 3:
        print("info for -Vvv")
    if Version >= 2:
        print(sys.version)
    if Version == 1:
        # subsumed into the above
        print(sys.version.split(" ")[0])

ChrisA


More information about the Python-ideas mailing list