string bug/oddity?

Oktay Safak oktay_safak at yahoo.com
Mon Aug 13 09:20:54 EDT 2001


--- Alex Martelli <aleaxit at yahoo.com> wrote:
> "Aahz Maruch" <aahz at panix.com> wrote in message
> news:9l7k5i$5eh$1 at panix2.panix.com...
> > In article <3B77150B.9F8FC079 at engcorp.com>,
> > Peter Hansen  <peter at engcorp.com> wrote:
> > >
> > >Anything wrong with this, simpler, approach?
> > >
> > >>>> for x in a.keys():
> > >...     print '%s%s' % (x, a[x])
> >
> > Even simpler and faster:
> >
> > for x,y in a.items():
> >     print '%s%s' % (x,y)
> 
> Simpler, yes.  Not necessarily faster, and I was
> surprised when I
> actually measured iteration on .keys vs iteration on
> .items: the
> allocation/building of the N pairs may apparently
> take longer
> than the N [] indexing operations.  Measure the two
> alternatives
> if you do need top speed at this point...
> 
> 
> Alex
> 
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list


Thanks for all the solutions suggested, I tried them
all and they all worked very well. I understood that
the problem with my code has been in type
identification process mainly. Now I know how to do it
properly. Terrific group! BTW, is it proper to post to
the group just to thank the responders? 

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/




More information about the Python-list mailing list