Skip to content

Commit

Permalink
#1 add duck typing
Browse files Browse the repository at this point in the history
  • Loading branch information
chuoru committed Aug 11, 2020
1 parent f7b70e6 commit 3234323
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions DesignPattern/Decorator/duck_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,13 @@


# 内部ライブラリ

class Specialstring:
def __len__(self):
return 21


# Driver's code
if __name__ == "__main__":
string = Specialstring()
print(len(string))
1 change: 1 addition & 0 deletions DesignPattern/Decorator/formatting_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def render(self):

if __name__ == '__main__':
before_gfg = WrittenText("GeeksforGeeks")

after_gfg = ItalicWrapper(UnderlineWrapper(BoldWrapper(before_gfg)))

print("before :", before_gfg.render())
Expand Down

0 comments on commit 3234323

Please sign in to comment.