Hi everyone. I created a custom class and had it inherit from the
"dict" class, and then I have an __init__ method like this:

def __init__(self):
        self = create()

The create function creates and returns a dictionary object. Needless
to say, this is not working. When I create an instance of the above
class, it is simply an empty dictionary rather than the populated
dictionary being created by the create function. Am I doing the
inheritance wrong, or am I getting the above syntax wrong by assigning
the return value to self?

I know I could do self.variable = create() and that works fine, but I
thought it would be better (and cleaner) simply to use the instance
itself as the dictionary, rather than have to go through an instance
variable.

Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to