[Python-Dev] Re: Decorators: vertical bar syntax
Simon Percivall
s.percivall at chello.se
Mon Aug 9 23:34:50 CEST 2004
On 2004-08-09, at 21.20, Simon Percivall wrote:
> On 2004-08-09, at 19.50, Fernando Perez wrote:
>> I further worry what will happen to tools like inspect.getsource()
>> with
>> decorators outside the def:
>>
>> @foo
>> @bar
>> def baz(x,y):
>> ....
>>
>> if I try to get the source for baz, will I see foo/bar? For
>> introspection
>> tools, this can lead to pretty misleading results. But perhaps this
>> is easy
>> to solve or has even already been taken care of. I imagine if
>> @foo/@bar were
>> inside the def, this wouldn't be an issue.
>
> Right now, you'll see the source of the function/method defined above
> the decorators or, if none, the top line/lines of the source file. Yes,
> it's pretty broken.
I uploaded a quick patch for this broken behaviour to SF, patch
1006219, if
anyone cares.
//Simon
More information about the Python-Dev
mailing list