Guest User

Untitled

a guest
Jun 22nd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. def equals(a, b):
  2. if isinstance(a, pony.orm.core.Entity):
  3. return type(a) == type(b) and a.get_pk() == b.get_pk()
  4. return a == b
  5.  
  6. with db_session:
  7. a = Customer[1]
  8. with db_session:
  9. b = Customer[1]
  10. print(a is b, a == b, equals(a, b)) # False, False, True
Add Comment
Please, Sign In to add comment