Sometimes my students are also learning English and it's fun to build on
that.
However, even if you're perfectly fluent in English, the following exhibit
might prove instructive, regarding Python:
"""
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 <http://xn--ub1a.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?"
---
Check it out and run it!
https://replit.com/@kurner/Ornery-Type#main.py
Kirby
_______________________________________________
Edu-sig mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/edu-sig.python.org/
Member address: [email protected]