[ create a new paste ] login | about

Link: http://codepad.org/Xb0TaKl9    [ raw code | output | fork | 1 comment ]

RogerPate - Python, pasted on Mar 15:
1
2
3
4
5
6
7
8
9
10
11
12
class A(object):
  def x(self): pass
  def y(self): pass

a = A()
print "is   ",    a.x  is    a.y
print "id ==", id(a.x) == id(a.y)

def is_(a, b):
  return id(a) == id(b)

print "is_()", is_(a.x, a.y)


Output:
1
2
3
is    False
id == True
is_() False


Create a new paste based on this one


Comments:
posted by RogerPate on Mar 15
reply