It's kind of weird that people seem to be missing the point about this. Python 
already has comprehensions for all the iterable builtins except strings. The 
proposed syntax doesn't introduce any new concept and would simply make strings 
more consistent with the rest of the builtins.  The argument that we can 
already do this with the "".join() idiom is backwards. It's something we have 
to do _because_ there's no way to write a string comprehensions directly. 
Comprehensions express intent. Joining a generator expression with an empty 
string doesn't convey the intent that you're building a string where each 
character is derived from another iterable.

Also I haven't seen anyone acknowledge the potential performance benefits of 
string comprehensions. The "".join() idiom needs to go through the entire 
generator machinery to assemble the final string, whereas a decent 
implementation of string comprehensions would enable some pretty significant 
optimizations.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/CYCM35RAKL7PMPGE2VYQ2ZPKK5RSMEZM/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to