467,122 Members | 1,292 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,122 developers. It's quick & easy.

Error when calling superclass __init__ method


Hi,

I'm getting an odd error while trying to call the __init__ method of a
super class:

BaseField.__init__(self)
TypeError: unbound method __init__() must be called with BaseField
instance as first argument (got nothing instead)
This is the code:

class BaseField(object):

def _addFieldsToRec(self, rec, *fields):
for field in fields:
self.mfn[field] = rec

def __init__(self):
self._addFieldsToRec(1,1)
self._addFieldsToRec(2, 500,501,502,503,504,505,506,507,508)
class Field(BaseField):
def __init__(self, value):
BaseField.__init__(self) # this seems to be the offending
line.
self.tag = value
What am I doing wrong?
Jun 27 '08 #1
  • viewed: 1625
Share:
1 Reply
Maese Fernando wrote:
I'm getting an odd error while trying to call the __init__ method of a
super class:

BaseField.__init__(self)
TypeError: unbound method __init__() must be called with BaseField
instance as first argument (got nothing instead)
This is the code:
No, it isn't. Please provide the actual code or, better, a minimal
example. Don't forget to run it to verify it shows the behaviour described
above before you post it.
What am I doing wrong?
My bets are on

BaseField.__init__() # no self

Peter
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Steven Bethard | last post: by
3 posts views Thread by Christian Dieterich | last post: by
14 posts views Thread by Axel Straschil | last post: by
6 posts views Thread by Rob Cowie | last post: by
reply views Thread by erik.erikson@gmail.com | last post: by
reply views Thread by Evan Klitzke | last post: by
6 posts views Thread by exhuma.twn | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.