[Tutor] What is the difference between checking false?

Jim Mooney cybervigilante at gmail.com
Sun Jun 16 07:13:54 CEST 2013


On 15 June 2013 21:41, Dave Angel <davea at davea.name> wrote:


>>>> class NobodyHome:
> ...     def __bool__(self):
> ...         return False  #normally, you'd be testing some attribute to
> decide this
>
> ...
>>>> x = NobodyHome()
>>>> not x
> True
>
That's a breath of fresh air - talk about freedom ;')  Makes me eager
to get to classes so I can redefine sets as tagged sets.

-- 
Jim
After indictment the bacon smuggler was put on the no-fry list


More information about the Tutor mailing list