fieldNullable = None fieldNotNullable = 'Some Value' fieldBoolean = False if fieldNullable is None: print("fieldNullable is null/None") else: print("fieldNullable is not null/None") if fieldNotNullable is None: print("fieldNotNullable is null/None") else: print("fieldNotNullable is not null/None") if fieldBoolean is None: print("fieldBoolean is null/None") else: print("fieldBoolean is not null/None") class TheClass1: def __main__(self, theObject): self.theObject = theObject theClass1 = TheClass1() if theClass1 is None: print("theClass1 is null/None") else: print("theClass1 is not null/None") if theClass1 == None: print("theClass1 is null/None") else: print("theClass1 is not null/None") class TheClass2: def __eq__(self, theObject): self.theObject = theObject #Always return true when check using == return True theClass2 = TheClass2() if theClass2 is None: print("theClass2 is null/None") else: print("theClass2 is not null/None") if theClass2 == None: print("theClass2 is null/None") else: print("theClass2 is not null/None")
fieldNullable is null/None
fieldNotNullable is not null/None
fieldBoolean is not null/None
theClass1 is not null/None
theClass1 is not null/None
theClass2 is not null/None
theClass2 is null/None