[Python-Dev] Re: Decorators: vertical bar syntax
Simon Percivall
s.percivall at chello.se
Mon Aug 9 21:20:35 CEST 2004
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.
More information about the Python-Dev
mailing list