setattr question
Kent Johnson
kent at kentsjohnson.com
Thu Mar 2 20:51:49 EST 2006
Gerard Flanagan wrote:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/86900
>
> mais il utilise 'apply', qui est...blah
>
> I was trying to implement the factory pattern.
> The recipe above uses 'apply' which is deprecated according to the
> docs, and I suppose I was curious how to do the same sort of thing
> without 'apply'.
Apply has been replaced by 'extended call syntax', that is why it is
deprecated. Instead of
return apply(self._function,_args,_kargs)
write
return self._function(*_args, **_kargs)
Kent
More information about the Python-list
mailing list