Deep override
Gustavo Cordova
gcordova at hebmex.com
Mon Feb 11 14:47:05 EST 2002
I've never used it, but I can give it a try:
>
> I have a module I'm writing for work that has a class that inherits
> from websucker.Sucker I'm trying to override websuckers' inheritance
> of webchecker.Checker.checkforhtml so it will just return 1(I want it
> to download some files, not html).
> I've tried different ways to name in and even tried to def it (Python
> didn't like all those dotted names in a def). Does anyone know how to
> get this to work?
> Thanks in advance for any insights.
>
In your own program:
====================
import webchecker
def AlwaysOne(*args,*kw): return 1
webchecker.Checker.checkforhtml = AlwaysOne
class SomethingElse(webchecker.Checker):
...etc etc...
====================
The important thing I'd think is to redefine
"checkforhtml" before Checked get's referenced
by your own class.
Dunno.
What does everyone else think?
Alas, I don't have my Python on this silly
employer's development machine.
Good luck!
-gustavo
More information about the Python-list
mailing list