> > def stringify(self, sep): > return sep.join(str(i) for i in self) > = map(sep.join(map(str, self))
However some folks want: def stringify(*args, *, sep:str=SomeDefault): return sep.join(map(str, args)) In order to have: >>> stringify(1, 2, "3", sep="-") 1-2-3 And I agree about the formatting, we know that str(x) and format(x) are synonyms so I'd suggest: def stringify(*args, *, sep:str=SomeDefault, fmt=''): return sep.join(format(x, fmt) for x in args) And the implicit call to str is really not surprising for a function called stringify IMO If you want a language designed specifically for text processing, use Perl. > True ! However typing python -cp "1+1" is really tempting... > Python is deliberately strongly typed, so that: > > 2 + “2” > > Raises an error. Why should: > > “”.join([2, “2”]) not raise an error as well? > I agree
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/