On Mar 24, 2:01 pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
[...]
>
> Yes, but what I'm asking is why the code objects have a co_name
> attribute. And even if there's a good reason for code objects to have a
> name, why do tracebacks use func.func_code.co_name instead of
> func.__name__?

>From what I remember when I looked at the source: stack frames execute
code objects, not functions.  They don't know what function has
spawned them, only what code object they are executing.  In fact when
one thinks of it, it makes more sense for code objects to have a name
(taken from the def statement) than for function objects, as there is
exactly one code object for every def statement.

--
Arnaud

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to