On 2010-10-17, Dun Peal <dunpea...@gmail.com> wrote:
> What's the fastest way to implement `all_ascii(L)`?

Start by defining it.

> 1. Match against a regexp with a character range: `[ -~]`

What about tabs and newlines?  For that matter, what about DEL and
BEL?  Seems to me that the entire 0-127 range are "ASCII characters".
Perhaps you mean "printable"?

> Any other ideas?  Which one do you think will be fastest?

I'd guess that a suitable regex (and see whether there's an
existing character class that already has the right semantics) will
be by far the fastest.  Just anchor it on both ends and nothing will
have to do any fancy evaluation to test it.

-s
-- 
Copyright 2010, all wrongs reversed.  Peter Seebach / usenet-nos...@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to