Hello,
I got this similar sample script from books:
$ cat sampdict.py
#!/usr/bin/python
class SampDict(dict):
def __init__(self, filename=None):
self["name"] = filename
But when I run it I got the errors:
>>> from sampdict import SampDict
>>> SampDict("/etc/passwd")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "sampdict.py", line 4, in __init__
self["name"] = filename
AttributeError: SampDict instance has no attribute '__setitem__'
I'm using Python 2.3.4.
Please help.Thanks.
--
http://mail.python.org/mailman/listinfo/python-list