Title: Lib/ be more pythonic
Type: performance Stage: resolved
Components: Build Versions: Python 3.8
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, dilyan.palauzov, r.david.murray, terry.reedy
Priority: normal Keywords:

Created on 2018-02-12 12:06 by dilyan.palauzov, last changed 2018-03-17 18:07 by r.david.murray. This issue is now closed.

Messages (5)
msg312040 - (view) Author: Дилян Палаузов (dilyan.palauzov) Date: 2018-02-12 12:06
diff --git a/Lib/distutils/command/ b/Lib/distutils/command/
--- a/Lib/distutils/command/
+++ b/Lib/distutils/command/
@@ -251,14 +251,11 @@ class sdist(Command):
         for fn in standards:
             if isinstance(fn, tuple):
                 alts = fn
-                got_it = False
                 for fn in alts:
                     if self._cs_path_exists(fn):
-                        got_it = True
-                if not got_it:
+                else:
                     self.warn("standard file not found: should have one of " +
                               ', '.join(alts))
diff --git a/Lib/email/ b/Lib/email/
--- a/Lib/email/
+++ b/Lib/email/
@@ -567,14 +567,7 @@ class DisplayName(Phrase):
     def value(self):
-        quote = False
-        if self.defects:
-            quote = True
-        else:
-            for x in self:
-                if x.token_type == 'quoted-string':
-                    quote = True
-        if quote:
+        if self.defects or any(x.token_type == 'quoted-string' for x in self):
             pre = post = ''
             if self[0].token_type=='cfws' or self[0][0].token_type=='cfws':
                 pre = ' '
diff --git a/Lib/idlelib/ b/Lib/idlelib/
--- a/Lib/idlelib/
+++ b/Lib/idlelib/
@@ -402,7 +402,7 @@ class IdleConf:
         because setting 'name' to a builtin not defined in older IDLEs
         to display multiple error messages or quit.
-        When default = True, 'name2' takes precedence over 'name',
+        When default is True, 'name2' takes precedence over 'name',
         while older IDLEs will just use name.  When default = False,
         'name2' may still be set, but it is ignored.
msg312041 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2018-02-12 12:09
We generally don't accept patches on Please open a pull request on github, see
msg312253 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-02-16 21:09
Dilyan, please explain what you believe the problems to be and how the patch solves it.  These seem to be 3 separate issues.

Do not change idlelib.config.  config_main.def contain 'default = True' or 'default = False' and that is what the docstring references.
msg313270 - (view) Author: Дилян Палаузов (dilyan.palauzov) Date: 2018-03-05 17:09
The variables got_it in distutils/command/sdist and quote in email/_header_value_parser can be skipped making the code shorter and faster.
msg314009 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2018-03-17 18:07
The risk of introducing a bug is higher than the minimal benefit of making the changes.  Thus we do not typically accept changes like this.  We'll clean up such code when we touching it for other reasons.
Date User Action Args
2018-03-17 18:07:58r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg314009

resolution: rejected
stage: resolved
2018-03-05 17:09:06dilyan.palauzovsetmessages: + msg313270
2018-02-16 21:09:35terry.reedysetnosy: + terry.reedy
messages: + msg312253
2018-02-12 12:09:38christian.heimessetnosy: + christian.heimes
messages: + msg312041
2018-02-12 12:06:40dilyan.palauzovcreate