@kurner/Ornery Type
Python3

No description

repl talk
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
This type of object gets along with nobody!

or·ner·y
ˈôrn(ə)rē/
adjective North American informal
adjective: ornery

    bad-tempered and combative.
    "some hogs are just mean and ornery"
    synonyms:	grouchy, grumpy, cranky, crotchety, cantankerous, bad-tempered, ill-tempered, dyspeptic, irascible, waspish; More
    
自 = self in Chinese, disregard errors
"""

class Ornery:
  
  def __init__(自, name="Fred"):
    自.name = name
    print("A sourpuss is born!")
    
  def __getitem__(自, key):
    return "How dare you touch me with those brackets!"
    
  def __call__(自, *args, **kwargs):
    return "Don't call me at home!"
    
  def __getattr__(自, attr):
    return "I'm insulted you'd suppose I'd have {}".format(attr)
    
  def __repr__(自):
    return "Don't bother me!  Go away."
  
  def __invert__(自):
    return "I can't invert, are you kidding?"
Python 3.6.1 (default, Dec 2015, 13:05:11) [GCC 4.8.2] on linux