t496.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. print str(None)
  2. print repr(None)
  3. print type(None)
  4. print isinstance(None, type(None))
  5. print "hello".split(None)
  6. if None:
  7. print False
  8. else:
  9. print None
  10. print "\nin/not in with a list"
  11. print None in [1,2,3]
  12. print None in [1,2,3,None]
  13. print None not in [1,2,3]
  14. print None not in [1,2,3,None]
  15. print "\nin/not in with a dict"
  16. print None in {1:2, 3:4}
  17. print None in {1:2, 3:4, None:5}
  18. print None not in {1:2, 3:4}
  19. print None not in {1:2, 3:4, None:5}
  20. print "\nis/is not"
  21. print None is None
  22. print None is not None
  23. print None is 3
  24. print 3 is None
  25. print None is not 3
  26. print 3 is not None
  27. print "\nboolean comparisons with int"
  28. print 3 == None
  29. print None == 3
  30. print 3 != None
  31. print None != 3
  32. print 3 > None
  33. print 3 >= None
  34. print 3 < None
  35. print 3 <= None
  36. print None > 3
  37. print None >= 3
  38. print None < 3
  39. print None <= 3
  40. print "\nboolean comparisons with long"
  41. print 3L == None
  42. print None == 3L
  43. print 3L != None
  44. print None != 3L
  45. print 3L > None
  46. print 3L >= None
  47. print 3L < None
  48. print 3L <= None
  49. print None > 3L
  50. print None >= 3L
  51. print None < 3L
  52. print None <= 3L
  53. print "\nboolean comparisons with None"
  54. print None == None
  55. print None != None
  56. print None > None
  57. print None >= None
  58. print None < None
  59. print None <= None
  60. # these should throw errors
  61. # print abs(None)
  62. # print chr(None)
  63. # print int(None)
  64. # print float(None)
  65. # print long(None)