undesired traceback
Courageous
jkraska1 at san.rr.com
Sun Aug 13 15:26:07 EDT 2000
> > why is this code giving me a traceback?
> > (TypeError: No arguments expected)
> >
> > class Foo:
> > def __init__():
> > pass
> >
> > f = Foo()
> def __init__(self):
To make this more clear, f = Foo() is looking for a
function defined as "def __init__(self):...", but the
one it found was "def __init__():...". Thus, when the
constructor was invoked, Python attempted to dispatch
it to the wrong version of __init__. This particular
version didn't expect there to be an argument, and yet,
when the contstructor was invoked, an argument was sent.
This resulted in the confusion above.
C//
More information about the Python-list
mailing list