Reputation: 33235
Some classes in our code base inherited from UserDict
to act like a dict
object.
I was trying to apply a metaclass
for them but I couldn't because they are old-style classes.
So, is there a new-style version of UserDict
I can use?
Upvotes: 2
Views: 251
Reputation: 23509
You can inherit from dict in current versions of Python.
From the documentation:
The need for this class has been largely supplanted by the ability to subclass directly from dict (a feature that became available starting with Python version 2.2).
Upvotes: 5