[issue37545] Argparse Tutorial - unreasonable operators

2019-07-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Zachary. The current writing is more errorproof.

--
nosy: +serhiy.storchaka
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37545] Argparse Tutorial - unreasonable operators

2019-07-11 Thread Aldwin Pollefeyt


Aldwin Pollefeyt  added the comment:

@Zachary, you are right ... the last one should be >= 1. Now i see the 
difference with the previous examples. It changed the output drastically from 
"the square of {} equals {}" vs "{}^2 == {}" to suddenly printing the filename 
at -vv. I was focused more on the structural change to always print answer. ... 
I will adjust.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37545] Argparse Tutorial - unreasonable operators

2019-07-10 Thread Aldwin Pollefeyt


Aldwin Pollefeyt  added the comment:

The >= is unnecessary in this exact example, as is correctly noted by Nathan.

I understand using >= for future purposes, after you explained, what is also 
correct but confusing because you specifically describe why you change the >= 
2, but it doesn't make sense for >= 1 then.

For the last example, I might be completely wrong (please don't shoot me), IMHO 
it can be == 1 also? It is not 'explicitly showing how to emit additional 
messages at higher verbosity levels', but to 'uses verbosity level to display 
more text'. So, removing the 'else' statement to always print(answer), no 
matter which verbosity is shown.

To avoid confusion, I recommend the change and please have another look at the 
last statement that makes no difference in using == or >=.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37545] Argparse Tutorial - unreasonable operators

2019-07-10 Thread Zachary Ware


Zachary Ware  added the comment:

I don't agree with the proposed change; I think the examples are fine as is.

Using `>= 1` means if you later decide that the `-vv` message should actually 
only happen at `-vvv` and `-vv` should get the same message as `-v`, you only 
have to change the 2 to a 3 and you're done.  With `== 1` you have to remember 
to either change `== 1` to `>= 1` or switch to `in {1, 2}`, or (more likely) 
forget to make the change initially and have to go back and fix it later.

The last example especially must not be changed; it is explicitly showing how 
to emit additional messages at higher verbosity levels.

I recommend closing this issue.

--
nosy: +zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37545] Argparse Tutorial - unreasonable operators

2019-07-10 Thread Aldwin Pollefeyt


Change by Aldwin Pollefeyt :


--
nosy: +aldwinaldwin

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37545] Argparse Tutorial - unreasonable operators

2019-07-10 Thread Aldwin Pollefeyt


Change by Aldwin Pollefeyt :


--
keywords: +patch
pull_requests: +14497
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14697

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37545] Argparse Tutorial - unreasonable operators

2019-07-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +paul.j3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37545] Argparse Tutorial - unreasonable operators

2019-07-10 Thread Nathan Oyama


New submission from Nathan Oyama :

In "Python 3.7 Documentation > Python HOWTOs > Argparse Tutorial" 
(https://docs.python.org/3.7/howto/argparse.html), search this page for

elif args.verbosity >= 1:

The operator ">=" should read "==" because args.verbosity cannot be 2 or 
greater after the if statement.

You would find the original codes unreasonable until you go through "if 
args.verbosity >= 1:".

--
assignee: docs@python
components: Documentation
messages: 347617
nosy: Culip, docs@python
priority: normal
severity: normal
status: open
title: Argparse Tutorial - unreasonable operators
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com