Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > I know that is a single list of tuples, I mean that can be used as > > well. > > > > for k, _ in d.items(): print k > > for _, v in d.items(): print v > > for k in d.keys(): print k > > for v in d.values(): print v > > > > Would there be a noticeable performance difference ? > > Sloppy use of print statements is a great way to produce misleading > benchmarks [1], since the time it takes to print lots of stuff tends to > overshadow the actual algorithm (for bonus points, print to a terminal > window, and use "time" to measure performance, so you get startup > times as well). If you don't necessarily want to print all the stuff, my > original assertion still holds: > BTW, it is not intended as a speed comparion of but more about the question of are the for "for"s have speed difference. The print is just that to complete the statement, I believe it can also be "pass" for performance purpose.
-- http://mail.python.org/mailman/listinfo/python-list