[Tutor] What is the difference between checking false?

eryksun eryksun at gmail.com
Sun Jun 16 10:45:40 CEST 2013


On Sat, Jun 15, 2013 at 11:53 PM, Jim Mooney <cybervigilante at gmail.com> wrote:
>
> class NobodyHome: pass
> x = NobodyHome()
> print(not x) # Result is False when I thought this would be True.

Quote:

>> If neither __bool__ nor __len__ is defined, the object defaults to being truthy:
>>
>>     >>> not not object()
>>     True
>>     >>> not object()
>>     False


More information about the Tutor mailing list