Message233554
I would like to suggest a new string function/constructor:
string.from_iterable(iterable [,map_function])
I think that the behaviour is intuitive: given an iterable, it construct a string using its element by apply a `map_function`, if provided, to each one of them. After that the str() constructor will be applied to each element in any way, to ensure that effectively an iterable of strings is used.
Of course I do not expect that you will accept this patch, but I think this really is a missing piece of the python library.
You can argue that I could just use
"".join(iterable)
but in my opinion there are two problems:
1) if any of the elements of `iterable` is not a `str` instance, it will fail miserably;
2) this is not very pythonic.
This issue is meant to be an idea for the python maintainers, so I did not write the corresponding `Doc/libary/string.rst` documentation, but if you are interested I could do it.
Thank you people for your amazing work. |
|
Date |
User |
Action |
Args |
2015-01-06 23:27:18 | youtux | set | recipients:
+ youtux |
2015-01-06 23:27:18 | youtux | set | messageid: <1420586838.31.0.418706320174.issue23179@psf.upfronthosting.co.za> |
2015-01-06 23:27:18 | youtux | link | issue23179 messages |
2015-01-06 23:27:18 | youtux | create | |
|