[issue44438] argparser documentation error

2021-06-16 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

If you read the text afterwards, you'll see that raising a TypeError was the 
intended purpose of this example.  Just afterward, it shows how to use *type* 
to make the code correct.

--
assignee:  -> rhettinger
nosy: +rhettinger
resolution:  -> not a bug
stage:  -> 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



[issue44438] argparser documentation error

2021-06-16 Thread Arman Sargsyan


Arman Sargsyan  added the comment:

I have signed the CLA

--

___
Python tracker 

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



[issue44438] argparser documentation error

2021-06-16 Thread Arman Sargsyan


New submission from Arman Sargsyan :

URL - https://docs.python.org/3/howto/argparse.html

The following code will return a type error:

import argparse
parser = argparse.ArgumentParser()
parser.add_argument("square", help="display a square of a given number")
args = parser.parse_args()
print(args.square**2)

This should be changed to:

import argparse
parser = argparse.ArgumentParser()
parser.add_argument("square", help="display a square of a given number")
args = parser.parse_args()
print(int(args.square)**2)

--
components: Parser
messages: 395963
nosy: arsar7, lys.nikolaou, pablogsal
priority: normal
pull_requests: 25349
severity: normal
status: open
title: argparser documentation error
type: resource usage
versions: Python 3.10, Python 3.11, Python 3.6, 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