There's got to be an easy way to do this (fwd)

James Logajan JamesL at Lugoj.Com
Thu Jul 5 19:28:27 EDT 2001


William Park wrote:
> 
> On Thu, Jul 05, 2001 at 05:42:00PM -0400, Lulu of the Lotus-Eaters wrote:
> >   def traditional(iters):
> >       for i in iters:
> >           result = ""
> >           for c in '(123)/456-7890':
> >               if c in digits:
> >                   result = result + c
> 
> Sorry to jump in the middle of thread (can't access newgroup at the
> moment).  Have you tried this one.
> 
>     def traditional(iters):
>         for i in iters:
>             result = []
>             for c in '(123)/456-7890':
>                 if c in digits:
>                     result.append(c)
>             "".join(result)

I thought of that and tried it: actually quite a bit slower!




More information about the Python-list mailing list