Wolfgang Rohdewald wrote:
> On Wednesday, 17. June 2009, Steven D'Aprano wrote:
>>         while text:
>>             for c in text:
>>                 if c not in printable: return False
> 
> that is one loop per character.

unless printable is a set

> wouldn't it be faster to apply a regex to text?
> something like
> 
> while text:
>       if re.search(r'\W',text): return False
> 

regex? Don't even start...

Anyway, only cProfile and profile would know who is the fastest...

And, is speed really that important for this case? Seems like premature
optimization to me.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to