Zajcev Evgeny <ze***@yandex.ru> wrote:
...
The following will work, and probably only be twice as slow as
'isalpha' :-) :
def alfa(w):
return w.replace('_', '').isalpha()
Yeah, great performance indeed, thanks!
Except it rejects a w that's JUST an underscore, while it would accept a
w that's just a letter, which seems weird to me. Using 'a' as the
second argument of the replace call, as somebody else suggested, appears
to produce a more sensible uniformity.
Alex