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

Fredrik Lundh fredrik at pythonware.com
Wed Jan 18 07:20:52 EST 2006


Claudio Grondi wrote:

> 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

since == can be overridden by the objects involved, == can do anything:

    http://docs.python.org/ref/customization.html

__lt__ __div__ F __gt__ 






More information about the Python-list mailing list