You don't need to return a boolean. You need to return an object that implements __bool__.
Get it ?
And even then, when you're dealing with objects that are special to expressions, you don't actually even need __bool__ that much
You don't need to return a boolean. You need to return an object that implements __bool__.
Get it ?
And even then, when you're dealing with objects that are special to expressions, you don't actually even need __bool__ that much