[issue38678] TypeError for Tutorial 10.3 Example 2

2019-11-17 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 39134b374fd506c5f0f6d232e259ba48c651d88f by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.8':
bpo-38678: Improve argparse example in tutorial (GH-17207) (GH-17212)
https://github.com/python/cpython/commit/39134b374fd506c5f0f6d232e259ba48c651d88f


--

___
Python tracker 

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



[issue38678] TypeError for Tutorial 10.3 Example 2

2019-11-17 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset d2faac63af007e52620c642dfcc576b787b55dcd by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.7':
bpo-38678: Improve argparse example in tutorial (GH-17207) (GH-17213)
https://github.com/python/cpython/commit/d2faac63af007e52620c642dfcc576b787b55dcd


--

___
Python tracker 

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



[issue38678] TypeError for Tutorial 10.3 Example 2

2019-11-17 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue38678] TypeError for Tutorial 10.3 Example 2

2019-11-17 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 04c79d6088a22d467f04dbe438050c26de22fa85 by Raymond Hettinger in 
branch 'master':
bpo-38678: Improve argparse example in tutorial (GH-17207)
https://github.com/python/cpython/commit/04c79d6088a22d467f04dbe438050c26de22fa85


--

___
Python tracker 

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



[issue38678] TypeError for Tutorial 10.3 Example 2

2019-11-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16715
pull_request: https://github.com/python/cpython/pull/17212

___
Python tracker 

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



[issue38678] TypeError for Tutorial 10.3 Example 2

2019-11-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16716
pull_request: https://github.com/python/cpython/pull/17213

___
Python tracker 

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



[issue38678] TypeError for Tutorial 10.3 Example 2

2019-11-17 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions: +Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue38678] TypeError for Tutorial 10.3 Example 2

2019-11-17 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Raymond's patch changes the tutorial example to something more useful for 
beginners.  It also gives the proper fix for the old example, which is to add 
'default=0' after "action='count'", but puts this in the proper place, the ref 
manual explanation of 'count'.

--

___
Python tracker 

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



[issue38678] TypeError for Tutorial 10.3 Example 2

2019-11-17 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
keywords: +patch
pull_requests: +16712
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/17207

___
Python tracker 

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



[issue38678] TypeError for Tutorial 10.3 Example 2

2019-11-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'll replace this example with more representative one that works.

--
assignee: docs@python -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue38678] TypeError for Tutorial 10.3 Example 2

2019-11-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Crash means 'python stopped erroneously without a traceback'. 

Same exception in 3.8 and 3.9.  Argparse uses None for a count of 0.  I 
consider this a bug.  If not changed, it should be documented.  As argparse is, 
the example needs to recode None to 0.  (Or, it could add '-v' to sys.argv.)  
With proper line wrapping, the result could be

import argparse
from getpass import getuser
parser = argparse.ArgumentParser(description='An argparse example.')
parser.add_argument('name', nargs='?', default=getuser(),  # wrap
help='The name of someone to greet.')
parser.add_argument('--verbose', '-v', action='count')
args = parser.parse_args()  # new
args.verbose = 0 if args.verbose is None else args.verbose
greeting = (["Hi", "Hello", "Greetings! its very nice to meet you"] #wrap
[args.verbose % 3])
print(f'{greeting}, {args.name}')

--
nosy: +terry.reedy
stage:  -> needs patch
title: TypeError raised trying to run TPT 10.3 Example 2 in Python 3.4.3 -> 
TypeError for Tutorial 10.3 Example 2
type: crash -> behavior

___
Python tracker 

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