Can a simple a==b 'hang' in and endless loop?

Claudio Grondi claudio.grondi at freenet.de
Wed Jan 18 07:09:32 EST 2006


In the process of learning about some deeper details of Python I am 
curious if it is possible to write a 'prefix' code assigning to a and b 
something special, so, that Python gets trapped in an endless loop in a 
line with:

if a==b: print 'OK'

I mean, it would be of much help to me on my way to understanding Python 
to know how such prefix code leading to an endless loop can look like 
and if it is eventually not possible to write such code, to know why it 
is not possible?

My own first rough idea was to create generators which never end and use 
them in the '==' comparison, but I have not well understood how to write 
and use generators yet, so I expect from studying this special case to 
come to some enlightenment.

Claudio



More information about the Python-list mailing list