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

Fredrik Lundh fredrik at
Wed Jan 18 11:30:35 EST 2006

Fuzzyman wrote:

> I'm not familiar with the C basic datatypes - I assume it has an array
> or list like object.
> Would it contain a sequence of poitners to the members ? In which case
> they would only be equal if the pointers are the same.
> In this case :
> a = ['some string']
> b = ['somestring']
> a == b
> False (probably)

the "value" of a C array is the address of its first argument.  two separate
arrays will never compare equal, no matter what they contain.

(C programs tend to use various "cmp" functions to compare stuff; it's up
to the programmer to keep track of how to compare things...)


More information about the Python-list mailing list