'==' operator not working correctly in python
Question: Following piece of code is behaving incorrectly in my script :

    
    
    from ctypes import *
    base_addr = c_uint64(0)
    base_addr_temp = c_uint64(0)
    print base_addr
    print base_addr_temp
    if(base_addr == base_addr_temp):
        print "val"
    

Output that i get :

> c_ulong(0L)
>
> c_ulong(0L)

I am using python 2.7.3 version.


Answer: I think that because these are objects, you'd have to compare them by value:

    
    
    base_addr.value == base_addr_temp.value
    

It's been a while since I've done any Python, but in many languages, two
objects are only considered "equal" if they actually refer to the same object
(i.e. reference the same location in memory).

