On Wed, Jan 30, 2019 at 11:24 AM Eric V. Smith <[email protected]> wrote:
> Your examples show literals, but I literally (heh) never use str.join
> this way. I always pass it some variable. And 100% of the time, if that
> variable (say it's a list) contains something that's not a string, I
> want it to raise an exception. I do not want this to succeed:
>
> lst = ['hello', None]
> ', '.join(lst)
>
> lst is usually computed a long way from where the join happens.
>
> So, I do not want this task automated for me.
That's a really good point ! So, maybe we have a parameter for that ...
from implode import implode
assert implode('-', [3, None, 2], none_str='') == '3-2'
Even that still seems pretty fuzzy to me, please, can you share an
idea for improvement ?
--
∞
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/