function override???
Gordon McMillan
gmcm at hypernet.com
Tue Nov 16 12:12:05 EST 1999
Arinte writes:
> I am defining a python callback for my embedded app, but I want
> the script writer to override my function. So, basically what I
> want is a function prototype. Ex. here is what I am thinking.
>
> ;---fprot.py
> def overrideme(self, str, someint)
>
> ;--fimp.py
> import fprot #I know this ain't right.
> # I don't know how to import from other
> python
> scripts yet. Enlighten me?
>
> def overrideme(self, str, someint)
> do_some_junk()
Is that a function or a method?
If it's a function, I would just document the signature. If it's a
method, I would expect the user to do:
import fprot
class MyThing(fprot.Thing):
def overrideme(self, strng, someint):
.....
In either case, when I'm implementing a callback, my first step
is to say something like:
def callback(*args):
print repr(args)
and see what turns up.
- Gordon
More information about the Python-list
mailing list