[Python-checkins] cpython (3.5): Issue #28455: Clarify example of overriding the convert_arg_line_to_args method
berker.peksag
python-checkins at python.org
Sun Oct 16 23:14:48 EDT 2016
https://hg.python.org/cpython/rev/4f8f7403881f
changeset: 104518:4f8f7403881f
branch: 3.5
parent: 104515:cbe313cd1b55
user: Berker Peksag <berker.peksag at gmail.com>
date: Mon Oct 17 06:14:17 2016 +0300
summary:
Issue #28455: Clarify example of overriding the convert_arg_line_to_args method
Patch by Mariatta Wijaya.
files:
Doc/library/argparse.rst | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -1958,10 +1958,11 @@
The method is called once per line read from the argument file, in order.
A useful override of this method is one that treats each space-separated word
- as an argument::
-
- def convert_arg_line_to_args(self, arg_line):
- return arg_line.split()
+ as an argument. The following example demonstrates how to do this::
+
+ class MyArgumentParser(argparse.ArgumentParser):
+ def convert_arg_line_to_args(self, arg_line):
+ return arg_line.split()
Exiting methods
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list