This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Lib/email/*.py use an EMPTYSTRING global instead of ''
Type: performance Stage: resolved
Components: Versions: Python 3.3
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: r.david.murray Nosy List: barry, gregory.p.smith, r.david.murray
Priority: low Keywords:

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:29adminsetgithub: 58931
2012-05-05 13:24:30r.david.murraysetstatus: open -> closed
resolution: works for me
messages: + msg159989

stage: resolved
2012-05-05 05:15:53barrysetmessages: + msg159978
2012-05-05 01:25:41r.david.murraysetnosy: + barry, r.david.murray
messages: + msg159975

assignee: r.david.murray
type: performance
2012-05-05 01:14:07gregory.p.smithcreate