Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Algo:
- def __init__(self, text=None):
- self.text = text
- def __int__(self):
- if self.text:
- return 1
- else:
- return 0
- a = Algo("Hola")
- b = Algo()
- print(int(a))
- print(int(b))
- # output:
- # 1
- # 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement