[Python-ideas] Access to function objects

Guido van Rossum guido at python.org
Tue Aug 9 13:44:27 CEST 2011


I was thinking from inside the executing code. It seems that your
problem is how to get to the function object underneath the stack of
decorators given an object that is the fully-decorated function. Never
mind then.

On Tue, Aug 9, 2011 at 12:01 AM, Ben Finney <ben+python at benfinney.id.au> wrote:
> Nick Coghlan <ncoghlan at gmail.com> writes:
>
>> On Tue, Aug 9, 2011 at 11:36 AM, Ben Finney <ben+python at benfinney.id.au> wrote:
>> > Which code object, though? If we can't get at the innermost function
>> > (which is the code location we're interested in) handling the URL,
>> > how will we get its line number?
>>
>> In general, you can't […]
>
> Thanks. I don't know what Guido was referring to, then, with:
>
>> But I'm not sure why the line number indicated by the code object
>> (which *is* accessible) is insufficient.
>
> Since the inner function's code object isn't reliably available, it's
> insufficient for reliably getting to the undecorated function which
> handles a specific Django URL.
>
> --
>  \       “… whoever claims any right that he is unwilling to accord to |
>  `\             his fellow-men is dishonest and infamous.” —Robert G. |
> _o__)           Ingersoll, _The Liberty of Man, Woman and Child_, 1877 |
> Ben Finney
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list