[Python-checkins] cpython: Issue #17940: Remove redundant code from _Section.format_help()

berker.peksag python-checkins at python.org
Sat Mar 5 07:05:41 EST 2016


https://hg.python.org/cpython/rev/be3874cf87f3
changeset:   100416:be3874cf87f3
parent:      100413:c1c8d2e27267
user:        Berker Peksag <berker.peksag at gmail.com>
date:        Sat Mar 05 14:05:45 2016 +0200
summary:
  Issue #17940: Remove redundant code from _Section.format_help()

Output of func(*args) stored in the next line:

    item_help = join([func(*args) for func, args in self.items])

_Section.items only used by HelpFormatter._add_item() and it looks
like it doesn't have any side effects.

Patch by Yogesh Chaudhari.

files:
  Lib/argparse.py |  2 --
  1 files changed, 0 insertions(+), 2 deletions(-)


diff --git a/Lib/argparse.py b/Lib/argparse.py
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -210,8 +210,6 @@
             if self.parent is not None:
                 self.formatter._indent()
             join = self.formatter._join_parts
-            for func, args in self.items:
-                func(*args)
             item_help = join([func(*args) for func, args in self.items])
             if self.parent is not None:
                 self.formatter._dedent()

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list