How clean/elegant is Python's syntax?

Ian Kelly ian.g.kelly at gmail.com
Fri May 31 11:43:54 EDT 2013


On Thu, May 30, 2013 at 1:38 PM, MRAB <python at mrabarnett.plus.com> wrote:
> And additional argument (pun not intended) for putting sep second is
> that you can give it a default value:
>
>    def join(iterable, sep=""): return sep.join(iterable)

One argument against the default is that it is specific to the str
type.  If you then tried to use join with an iterable of bytes objects
and the default sep argument, you would get a TypeError.  At least not
having the default forces you to be explicit about which string type
you're joining.



More information about the Python-list mailing list