t522.py 535 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. class A:
  2. def __len__(self):
  3. return 0
  4. print bool(A())
  5. class B:
  6. def __len__(self):
  7. return False
  8. print bool(B())
  9. class C:
  10. def __nonzero__(self):
  11. return 0
  12. print bool(C())
  13. class D:
  14. def __nonzero__(self):
  15. return False
  16. print bool(D())
  17. class E:
  18. def __len__(self):
  19. return 1
  20. print bool(E())
  21. class F:
  22. def __nonzero__(self):
  23. return 1
  24. print bool(F())
  25. class G:
  26. def __nonzero__ (self):
  27. return 0
  28. def __len__ (self):
  29. return 1
  30. print bool(G())