[Python-Dev] A house upon the sand

Barry A. Warsaw barry@digicool.com
Mon, 27 Nov 2000 09:52:19 -0500


>>>>> "GE" == Greg Ewing <greg@cosc.canterbury.ac.nz> writes:

    GE> I think there are still legitimate reasons for using some
    GE> parts of the string module. For example, if you're one of
    GE> those stubborn people who refuse to accept that ",".join(foo)
    GE> is a better way of writing string.join(foo,",").

Actually, an even better way is

COMMA = ','
COMMA.join(foo)

To me, that is substantially easier to read than either of the above
two alternatives.

>>>>> "Fred" == Fred L Drake, Jr <fdrake@acm.org> writes:

    Fred>   There will never be an excuse for that!  .join() should
    Fred> never have been added as a method!

Of course, I completely disagree.  However, I have noticed that I
often define string constants like

SPACE = ' '
EMPTY = ''
NL = '\n'

just so I can write code like

NL.join(headers)
SPACE.join(names)
EMPTY.join(lines)

I doubt it's worth it, but maybe having a standard module called
stringconstants.py with some of the more obvious choices would make
things better?

toowtdi-my-foot-ly y'rs,
-Barry