Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
かけ算

result

♥♥

Press ENTER or type command to continue

# -*- coding:utf-8 -*-
BROKEN_HEART = ""
class Person(object):
def __mul__(self, other):
if not isinstance(other, Person):
return BROKEN_HEART
return "♥♥"
def __rmul__(self, other):
if not isinstance(other, Person):
return BROKEN_HEART
return None
def main():
drillbits, pasberth = Person(), Person()
print(drillbits * pasberth)
feiz = Person()
print(feiz * None)
print(0 * feiz)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.