apply for objects
Michal Wallace
sabren at manifestation.com
Wed Jun 21 15:39:45 EDT 2000
On Thu, 15 Jun 2000, Hahn S wrote:
> class TestHandler:
> def start(self, **attrs):
> print "%s %s" % (name, attrs)
>
> def dispatch(self, style, attrs):
> if style == 'begin':
> apply(self.start, attrs)
>
> Now this won't work, because the self.start doesn't have a __call__
> property. Any ideas how to solve this?
>
> The **attrs in start is necessary, because there is other code calling
> this function.
I don't think it has anything to do with __call__, since start is
a method. The problem is with your use of apply. The syntax is:
apply(somefunction, arglist, [kwargs])
... so you probably mean this:
def dispatch(self, style, **attrs):
if style == 'begin':
apply(self.start, (), attrs)
Cheers,
- Michal
------------------------------------------------------------------------
www.manifestation.com www.sabren.com www.linkwatcher.com www.zike.net
------------------------------------------------------------------------
More information about the Python-list
mailing list