What will happen? ```python a = Person() if not a: print("No one here") else:...
What will happen?
```python
a = Person()
if not a:
print("No one here")
else:
print("Things make sense")
```
Prints "No one here" of course!
Self-replies
Override bool and delegate that to just whatever because people are Falsy until they eat lunch.
```
class Person():
def __init__(self):
self.lunch = None
def eat(self, lunch):
self.lunch = lunch
def __bool__(self):
return bool(self.lunch)
```
Brought to you by a certain caching library.