Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- D:\PyCharmProjects\fliki>python
- Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32
- Type "help", "copyright", "credits" or "license" for more information.
- >>> class LazyClass:
- ... def __init__(self, name):
- ... self.name = name
- ...
- ... def __eq__(self, other):
- ... return self.name[0] == other.name[0]
- ...
- >>> able = LazyClass('able')
- >>> alpha = LazyClass('alpha')
- >>>
- >>> print("able " + ("is" if able == alpha else "is NOT") + " equal to alpha")
- able is equal to alpha
- >>> print("able " + ("isn't" if able != alpha else "isn't NOT") + " equal to alpha")
- able isn't NOT equal to alpha
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement