[Python-Dev] sum(...) limitation (original) (raw)

Ben Hoyt benhoyt at gmail.com
Mon Aug 11 14:26:47 CEST 2014


It seems to me this is something of a pointless discussion -- I highly doubt the current situation is going to change, and it works very well. Even if not perfect, sum() is for numbers, sep.join() for strings. However, I will add one comment:

I'm overall -1 on trying to change the current situation (except for

adding a join() builtin or str.join class method).

Did you know there actually is a str.join "class method"? I've never actually seen it used this way, but for people who just can't stand sep.join(seq), you can always call str.join(sep, seq) -- works in Python 2 and 3:

str.join('.', ['abc', 'def', 'ghi']) 'abc.def.ghi'

This works as a side effect of the fact that you can call methods as cls.method(instance, args).

-Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20140811/3cc8746d/attachment.html>



More information about the Python-Dev mailing list