>> 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:
>

Fortunately, it's a counting option already.  In Modules/main.c:

        case 'v':
            Py_VerboseFlag++;
            break;
...
        case 'V':
            version++;
            break;
...
    if (version) {
        printf("Python %s\n", PY_VERSION);
        return 0;
    }


So change is easy:

diff -r 0b29adb5c804 Modules/main.c
--- a/Modules/main.c Mon Oct 17 06:14:48 2016 +0300
+++ b/Modules/main.c Mon Oct 17 15:00:26 2016 +0900
@@ -512,7 +512,12 @@ Py_Main(int argc, wchar_t **argv)
         return usage(0, argv[0]);

     if (version) {
-        printf("Python %s\n", PY_VERSION);
+        if (version >= 2) {   // or if (version >= 2 || Py_VerboseFlag) {
+            printf("Python %s\n", Py_GetVersion());
+        }
+        else {
+            printf("Python %s\n", PY_VERSION);
+        }
         return 0;
     }


$ ./python.exe -V
Python 3.6.0b2+

$ ./python.exe -VV
Python 3.6.0b2+ (3.6:0b29adb5c804+, Oct 17 2016, 15:00:12)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)]

$ ./python.exe -VVV
Python 3.6.0b2+ (3.6:0b29adb5c804+, Oct 17 2016, 15:00:12)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)]

-- 
INADA Naoki  <songofaca...@gmail.com>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to