type = "instance" instead of "dict"

Kent Johnson kent at kentsjohnson.com
Mon Feb 27 16:55:58 EST 2006


Cruella DeVille wrote:
> So what you are saying is that my class Dict is a subclass of Dict, and
> user defined dicts does not support iteration?

I don't know what your class Dict is, I was guessing. The built-in is 
dict, not Dict.
> 
> What I'm doing is that I want to write the content of a dictionary to a
> file, and send the dictionary (favDict) as a parameter like this:
> favDict = Dict() <-- my own class (or not?)

Is this actual code or are you typing from memory?

> # put things in favDict (works fine)
> fileToWrite.writeFile(favDict) # AttributeError: Dict instance has no
> attribute 'itervalues'

What version of Python are you using? itervalues() is in Python 2.2 and 
later.

Kent



More information about the Python-list mailing list