]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #28455: Clarify example of overriding the convert_arg_line_to_args method
authorBerker Peksag <berker.peksag@gmail.com>
Mon, 17 Oct 2016 03:14:17 +0000 (06:14 +0300)
committerBerker Peksag <berker.peksag@gmail.com>
Mon, 17 Oct 2016 03:14:17 +0000 (06:14 +0300)
Patch by Mariatta Wijaya.

Doc/library/argparse.rst

index fab072788f50bb1e78cfcb48da4b03da0f470aea..879bfed7e37fb9650d0770770fc506fb1368e491 100644 (file)
@@ -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