Re: v1.0.2 question

Tim Peters (tim@ksr.com)
Wed, 04 May 94 16:05:50 -0400

> [tommy]
> ...
> Python 1.0.2 (May 4 1994)
> Copyright 1991-1994 Stichting Mathematisch Centrum, Amsterdam
> >>> vars()
> {'__name__': '__main__', '_': {'__name__': '__main__', '_':
> {'__name__': '__main__', '_': {'__name__': '__main__', '_':
> {'__name__': '__main__', '_': {'__name__': '__main__', '_':
> ... endless repetitions

> The output I got was not what I expected. Was this a bug?

Maybe not strictly, but it is a hoot <grin>! The new feature is that '_'
is automatically set to the result of the last auto-printed expression.
So I think what's happening is:

1) vars() returns the namespace N == {'__name__': '__main__'}.

2) The auto-printer '_' hack binds '_' to N before printing, which
changes the namespace to N == {'__name__': '__main__, '_': N}.

3) The attempt to print N == {'__name__': '__main__, '_': N} then falls
into infinite recursion.

At least that matches the symptoms.

speculatingly y'rs - tim

Tim Peters tim@ksr.com
not speaking for Kendall Square Research Corp