Inheritance confusion

Ben Finney bignose+hates-spam at
Sat Apr 19 09:05:45 CEST 2008

Hook <Hook at> writes:

> I'm having a problem with multiple inheritance

You aren't alone. Multiple inheritance (MI) is difficult to implement,
and once implemented, usually difficult to understand and sometimes

I recommend you read and absorb the article "The Truth about super"
<URL:> to
understand more about MI in Python.

However, there are more fundamental issues:

> I've got 4 files

That should be irrelevant to MI problems. Please refine your example
so that it's in one module, and still exhibits the problem.

> When I run the script I get this:
> Traceback (most recent call last):
>   File "./", line 20, in <module>
>     Obj.Connect ('Database')
>   File "/mnt/isis/Projects/Python/Learning/", line 102, in Connect
>     self.TRACE ("DB::Connect (" + database + "," + mode)
>   File "/mnt/isis/Projects/Python/Learning/", line 314, in TRACE
>     self.DailyLog (msg)
>   File "/mnt/isis/Projects/Python/Learning/", line 98, in 
> DailyLog
>     dt          = self.Date (time ())
> TypeError: 'module' object is not callable

No, you don't. That might be what you get from *your* code, but it's
not produced by the code you *posted*. (I know this if only because
none of your modules have a line 98 on which to raise an exception.)

So, since we don't have the code that generates that traceback, that
traceback isn't useful to us for diagnosing the problem.

> If you need to see all the source, can do, but it's certainly too
> much for an intro message!

Indeed. Instead, re-work your code (based on a copy) until it's as
simple as it can be, and *still* shows the problems when you execute
it. Then, if you still don't know why the traceback occurs, feel free
to post that minimal example with the corresponding traceback.

 \          "Jury: A group of 12 people, who, having lied to the judge |
  `\       about their health, hearing, and business engagements, have |
_o__)                        failed to fool him."  -- Henry L. Mencken |
Ben Finney

More information about the Python-list mailing list