On Sun, 27 Feb 2005 18:12:17 -0700, rumours say that Steven Bethard <[EMAIL PROTECTED]> might have written:
[snip Nick Coghlan's list comprehension] [STeVe] >On the other hand, filter doesn't do the same thing: > >py> s = u'The Beatles - help - 03 - Ticket to ride' >py> filter(str.isalpha, s) >Traceback (most recent call last): > File "<interactive input>", line 1, in ? >TypeError: descriptor 'isalpha' requires a 'str' object but received a >'unicode' >py> ''.join(c for c in s if c.isalpha()) >u'TheBeatleshelpTickettoride' This works though: .>> filter(type(s).isalpha, s) As a function just for clarity. -- TZOTZIOY, I speak England very best. "Be strict when sending and tolerant when receiving." (from RFC1958) I really should keep that in mind when talking with people, actually... -- http://mail.python.org/mailman/listinfo/python-list