Can a simple a==b 'hang' in and endless loop?
Steven D'Aprano
steve at REMOVETHIScyber.com.au
Fri Jan 20 18:52:06 EST 2006
On Thu, 19 Jan 2006 10:08:38 +0100, Claudio Grondi wrote:
> The point is to find a way to create in Python two indentifiers a and b
> without manipulating any of the __eq__ and to __eq__ related functions
> in a way, that the simple
> if a==b: print 'a==b'
> statement results in an endless loop.
Why would you want to?
> To my knowledge this is not possible to achieve in C, but is probably
> achievable in Python.
I doubt it.
The closest I can think of is something like this:
a = []
a.append(a)
b = []
b.append(b)
a == b
which I'm told used to cause an endless loop in early versions of Python,
but now simply returns True.
--
Steven.
More information about the Python-list
mailing list