On 9/17/2010 9:21 PM, M. 427 wrote:
Thank you,
After reading the following documentations
http://docs.python.org/tutorial/datastructures.html#looping-techniques
http://docs.python.org/tutorial/controlflow.html#for-statements
I ended up with this :

Version 3 :
for i,row in d[:].iteritems() : # BUG : TypeError: unhashable type
     if len(row)<  2 :
         del d[i]

Still buggy... Any lead for this error message? Is a slice unhashable?
Am I looking in the right direction for this task?
Where did you see [:] after a dict? [:] is slicing, and applies to a sequence not a mapping.

Also note the warning "Using iteritems() while adding or deleting entries in the dictionary may raise a RuntimeError or fail to iterate over all entries."

You should get a list rather than an iterator of all key-value pairs then iterate over that list.

--
Bob Gailer
919-636-4239
Chapel Hill NC

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to