UserDict deprecated

Steven Bethard steven.bethard at
Sat Jan 1 17:34:14 EST 2005

Uwe Mayer wrote:
> Saturday 01 January 2005 22:48 pm Hans Nowak wrote:
>>I am curious, what would you do with a class that derives from both file
>>and dict?
> I was writing a class that read /writes some binary file format. I
> implemented the functions from the file interface such that they are
> refering to records. However, the file format has some header fields and
> I'd wanted to grant access to those via the dict-interface.

If you implemented the file interface functions yourself, why do you 
want to inherit from file?

> Another example: working with PyQt I have an instance of a QListView and
> wanted to use the list-interface to get and set individual records.

But just inheriting from list won't make this work, will it?  Don't you 
want to do something like:

class C(QListView):
     def __getitem__(self, i):
         return self.getIndividualRecord(i) # or whatever method gives
                                            # you the record


More information about the Python-list mailing list