diff options
| author | Berker Peksag <berker.peksag@gmail.com> | 2016-10-17 06:14:17 +0300 |
|---|---|---|
| committer | Berker Peksag <berker.peksag@gmail.com> | 2016-10-17 06:14:17 +0300 |
| commit | 5493e4723a922b9905cf6916363e72109a531cfd (patch) | |
| tree | f83634c824abf4b4ecdc7715dab5eab52be84ab5 | |
| parent | 8d761ff045ab3aa6787d1ee8dc2ee4b39b424a64 (diff) | |
| download | cpython-git-5493e4723a922b9905cf6916363e72109a531cfd.tar.gz | |
Issue #28455: Clarify example of overriding the convert_arg_line_to_args method
Patch by Mariatta Wijaya.
| -rw-r--r-- | Doc/library/argparse.rst | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index fab072788f..879bfed7e3 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -1958,10 +1958,11 @@ Customizing file parsing 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:: + as an argument. The following example demonstrates how to do this:: - def convert_arg_line_to_args(self, arg_line): - return arg_line.split() + class MyArgumentParser(argparse.ArgumentParser): + def convert_arg_line_to_args(self, arg_line): + return arg_line.split() Exiting methods |
