> the ONLY predicate that can be expressed about a single character is it being 
> a member of a subset of all Unicode characters

You seem to be assuming that the comprehension would be purposefully restricted 
to iterating over strings. The original author already provided examples with 
predicates that don't involve checking for a subset of characters.

    old = [0, 1, None, 2]
    new = c"str(x + 1) for x in old if isinstance(x, int)"

The existing "".join() idiom isn't restricted to iterating over an existing 
string. You also have to account for nested comprehensions. There's nothing 
that would prevent you from having arbitrary complexity in string comprehension 
predicates, just like nothing prevents you from having arbitrary predicates 
when you join a generator expression.
_______________________________________________
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/6T7NQT5HFVYSI3RHUCBDDCEWKJ7HDPZG/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to