
I thought I had sent a response to this a few hours ago, but it seems to have been eaten by the email gremlins. Apologies if this ends up as a duplicate. On Fri, Apr 30, 2021 at 12:03:15PM -0400, David Álvarez Lombardi wrote:
I propose a syntax for constructing/filtering strings analogous to the one available for all other builtin iterables.
*All* others? The builtin interables bytearray, bytes, enumerate, filter frozenset, map, memoryview, range, reversed, tuple and zip suggest differently. It isn't that str is the exceptional case, it is that dict, list and set are the exceptional cases. In fact, there is a sense that this is a historical accident, that list comprehensions happened to have been invented first. If we were re-designing Python from scratch today, it is quite likely that we would have only generator comprehensions: list(expression for x in iterable) set(expression for x in iterable) dict((key, value) for x in iterable) -- Steve