naive question about tracebacks

logistix logistix at zworg.com
Wed Feb 19 22:15:02 EST 2003


Andrew Koenig <ark at research.att.com> wrote in message news:<yu997kbwovik.fsf at europa.research.att.com>...
> >>> def foo():
> ...     bar() 
> ... 
> >>> def bar():
> ...     baz()
> ... 
> >>> foo()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "<stdin>", line 2, in foo
>   File "<stdin>", line 2, in bar
> NameError: global name 'baz' is not defined
> 
> 
> If the most recent call is last, why is it called a traceback
> instead of a traceforward?
> 
> More generally, why is the most recent call last?  Is it because
> of the presumption that the earlier calls will scroll off the
> top of the screen?

Duuude,

Which way does a stack grow in memory? It starts at lower addresses
and climbs to higher ones.  The traceback is just printing the stack
frames in sequential order, instead of printing the frames as it pops
them off.

-logistix




More information about the Python-list mailing list