Hi Jim, items() returns a new list in memory, so if your dictionary is very big it could be a problem. iteritems() is lazy, it creates an iterator object which keeps track of the current state, so it doesn't build a list in advance. Python 3.0 uses the lazy method, so that items behaves like iteritems and range behaves like xrange, and so on. --Jim ----- Original Message ----- From: Homme, James To: programmingblind@xxxxxxxxxxxxx Sent: Friday, April 03, 2009 3:29 PM Subject: RE: quick python question Hi Jim, What's the difference between the two syntaxes in the way Python handles this? Is it 3.0 as opposed to older Python? Thanks. Jim ---------- Jim Homme, Usability Engineering. 412-544-1810. Catch the gratitude attitude. From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jim Dunleavy Sent: Friday, April 03, 2009 9:28 AM To: programmingblind@xxxxxxxxxxxxx Subject: Re: quick python question Hi Tyler, That just iterates on the keys. You need to do: for key, val in self.vars.iteritems(): or for key, val in self.vars.items(): --Jim ----- Original Message ----- From: Tyler Littlefield To: programmingblind@xxxxxxxxxxxxx Sent: Friday, April 03, 2009 12:02 PM Subject: quick python question Hello list, I've got a question; I'm trying to itterate through a dictionary like: for key,val in self.vars: print key print val when I do it, it says "to many values to unpack." What's that supposed to mean? Is there a way of debugging the code so I can make sure this is really a dictionary? Thanks, Tyler Littlefield Web: tysdomain.com email: tyler@xxxxxxxxxxxxx My programs don't have bugs, they're called randomly added features. -------------------------------------------------------------------------------- This e-mail and any attachments to it are confidential and are intended solely for use of the individual or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately and then delete it. If you are not the intended recipient, you must not keep, use, disclose, copy or distribute this e-mail without the author's prior permission. The views expressed in this e-mail message do not necessarily represent the views of Highmark Inc., its subsidiaries, or affiliates. ---------------------------------------------------------------------------- "Information in this email (including attachments) is confidential. It is intended for receipt and consideration only by the intended recipient. If you are not an addressee or intended recipient, any use, dissemination, distribution, disclosure, publication or copying of information contained in this email is strictly prohibited. Opinions expressed in this email may be personal to the author and are not necessarily the opinions of the HSE. If this email has been received by you in error we would be grateful if you could immediately notify the ICT Service Desk by telephone at +353 1 6352757 or by email to service.desk@xxxxxx and thereafter delete this e-mail from your system" ----------------------------------------------------------------------------