Issue 14726: Lib/email/*.py use an EMPTYSTRING global instead of '' (original) (raw)

Created on 2012-05-05 01:14 by gregory.p.smith, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg159974 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2012-05-05 01:14
Lib/email/*.py are fond of using EMPTYSTRING = '' and within the code: EMPTYSTRING.join(...) instead of just writing: ''.join(...) They should just do the latter. It'll avoid a name lookup and look less silly to people reading the code. ;)
msg159975 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-05-05 01:25
I've always wondered why the code did that. If Barry doesn't have a good reason for it, I'll refactor it at some point.
msg159978 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2012-05-05 05:15
On May 05, 2012, at 01:25 AM, R. David Murray wrote: >I've always wondered why the code did that. If Barry doesn't have a good >reason for it, I'll refactor it at some point. A long time ago, Tim (IIRC) expressed an opinion that using the variable makes the code more readable. After having seen so much code that uses the string literals over the years, I wholeheartedly agree with that opinion.
msg159989 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-05-05 13:24
Good enough for me. I personally don't find it to be easier or harder to read with the names, so let's keep them.
History
Date User Action Args
2022-04-11 14:57:29 admin set github: 58931
2012-05-05 13:24:30 r.david.murray set status: open -> closedresolution: works for memessages: + stage: resolved
2012-05-05 05:15:53 barry set messages: +
2012-05-05 01:25:41 r.david.murray set nosy: + barry, r.david.murraymessages: + assignee: r.david.murraytype: performance
2012-05-05 01:14:07 gregory.p.smith create