Python day 21:
想见你 (Someday or One day) is one of the most popular and highly-rated dramas on Douban 2019 data. But i did not understand the story timeline because it involved a time-traveling element. My brain was burned, after watching some youtube explaining, I still didn’t get the story.
But I decide to make a python class to show the timeline.
Key Concept:
Implicit: pass a well-defined function from the parent class to the child class.
Override: replace a parent function in order to carry different behavior.
Alter: compare the different behaviors before or after the parent class version.
Someday or One Day timeline Python Code:
class want2cu(object): def override(self): print("2019-want to see you, i only want to see u") def implicit(self): print("2019-past, now, future, i only want 2cu") def altered(self): print("2019-not in the same dimension") class memory(want2cu): def override(self): print ("2012-happy together") def altered(self): print("2019-last dance") super(memory, self).altered() print("they see each other in 2012 and 2019 ???? ^_^!")
now=want2cu() past=memory()
now.override() past.override()
2019-want to see you, i only want to see u 2012-happy together
now.implicit() past.implicit()
2019-past, now, future, i only want 2cu 2019-past, now, future, i only want 2cu
now.altered() past.altered()
2019-not in the same dimension 2019-last dance 2019-not in the same dimension they see each other in 2012 and 2019 ???? ^_^!
Happy studying!