Cruella DeVille wrote: > I'm trying to implement a bookmark-url program, which accepts user > input and puts the strings in a dictionary. Somehow I'm not able to > iterate myDictionary of type Dict{} > > When I write print type(myDictionary) I get that the type is > "instance", which makes no sense to me. What does that mean? > Thanks >
Perhaps you did not know that you can inheret directly from dict, which is the same as {}. For instance: class Dict({}): pass Is the same as class Dict(dict): pass Now Dict can do everything that dict ({}) can do, but you can also specialize it: py> class Dict(dict): ... def __str__(self): ... return "I am %s long. But you should read the tutorial!" % len(self) ... py> d = Dict() py> d['a'] = 1 py> d['b'] = 2 py> py> d['a'] 1 py> d['b'] 2 py> print d I am 2 long. But you should read the tutorial! James -- http://mail.python.org/mailman/listinfo/python-list