Fastest way to detect a non-ASCII character in a list of strings.

Grant Edwards invalid at invalid.invalid
Mon Oct 18 16:28:02 CEST 2010

On 2010-10-18, Steven D'Aprano <steve-REMOVE-THIS at> wrote:

> Neither is accurate. all_ascii would be:
> all(ord(c) <= 127 for c in string for string in L)


> all_printable would be considerably harder. As far as I can tell, there's 
> no simple way to tell if a character is printable.

There's no easy way to even define what "printable" means.  Ask three
different people, and you'll get at least four different answers

Grant Edwards               grant.b.edwards        Yow! If elected, Zippy
                                  at               pledges to each and every
                                American a 55-year-old
                                                   houseboy ...

More information about the Python-list mailing list