funcoperators is pretty neat ! But at this stage of the discussion I
would also try to get automatic string casting since the purpose is to
assemble a string.

It would be great in the stdlib because switching between os.path.join
and str.join is so error-prone, and assembling strings seems like a
pretty common task. It's not uncommon to find str.join in arguments
against Python.

Monkey patching str in PYTHONTARTUP.py would work, but then that would
require users pulling my package to also hack their startup script. Or
even worse: we could patch the startup script upon package
installation. It seems like it would make redistribution a lot harder
than it should.

Another approach would be to add a stringify(delim='\n') method to
iterables, it would accept a delimiter argument and would return a
string of all items casted to string and separated by the delimiter.

That would be certainly more backward-compatible than supporting an
alternate str.join(1, 'b') call.

Meanwhile I've opened a PR on boltons, but, well, it looks a lot like
php.net/implode, and I'm not really sure we want that :D

https://github.com/mahmoud/boltons/pull/197/commits/2b4059855ab4ceae54032bff55da0a6622f1ff01#diff-51cb56be573adcc71320e6953926bc52R430

-- 
∞
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to