Self-referential objects (was Re: more on splitfields)

Tim Peters (tim@ksr.com)
Wed, 19 Aug 92 17:30:36 -0400

> ...
> While we are on the topic of infinite loops in library
> functions/methods the following will also cause infinite looping:
>
> a = [2, 'abc']
> a.append(a)
>
> There are a number of possibilities:
> ...

Works fine for me, Lou:

Python 0.9.6 (>= 1 Jan 1992).
Copyright 1990, 1991, 1992 Stichting Mathematisch Centrum, Amsterdam
>>> a = [2,'abc']
>>> a.append(a)
>>> len(a)
3
>>> (a is a[2])
1
>>>

This is a UNIX(tm) flavor of Python. Suspect you're looking at an
installation problem, or are trying to print the thing (& the docs warn
against trying to print self-referential objects -- you do get into an
infinite loop then).

personally-already-like-what-python-does-with-this-ly y'rs - tim

Tim Peters Kendall Square Research Corp
tim@ksr.com, ksr!tim@uunet.uu.net