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

Grant Edwards invalid at invalid.invalid
Mon Oct 18 10:28:02 EDT 2010


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

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

Definitely.

> 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
answers.

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



More information about the Python-list mailing list