[IronPython] Plans for overloads?
Niki Spahiev
niki at vintech.bg
Mon Aug 1 16:46:04 CEST 2005
Morgan Martinet wrote:
>>Interesting, but this seems to be purely for decorating method definitions,
>>not method calls, and I'm not sure how any similar syntax would help.
>
> This is not completely true. The way decorators work is that they wrap the
> decorated object (either the function or another decorator if you cascade
> them). The decorator is a Python object by itself, that can override
> __call__ to implement its own behaviour, allowing you to route the call to
> the proper method for instance. The decorator object can also contain its
> own attributes that would help it take the right decision...
>
>
>>The only thing I could think of would be to hint the parser, which may be
>>what you had in mind.
>
> This is also a possibility as it would respect the Python syntax but would
> allow you to introduce new attributes...
ctypes uses decorators for describing calling signatures.
HTH
Niki Spahiev
More information about the Ironpython-users
mailing list