Skip to content
Snippets Groups Projects
Commit 984d91af authored by Brady James Garvin's avatar Brady James Garvin
Browse files

Deferred example of duck typing.

parent 29859906
Branches master
No related tags found
No related merge requests found
class Visit(object):
def __init__(self):
self.notes = []
def add_note(self, note):
self.notes.append(note)
class Appointment(object):
def __init__(self):
self.note = None
def add_note(self, note):
self.note = note
def void(event):
event.add_note('Voided.')
if __name__ == '__main__':
visit = Visit()
appointment = Appointment()
number = 7
void(visit)
print(visit.notes)
void(appointment)
print(appointment.note)
void(number)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment