DIFF.BLOG
New
Following
Discover
Jobs
More
Top Writers
Suggest a blog
Upvotes plugin
Report bug
Contact
About
Sign up  
[Python] build-in objectに独自のメソッドを追加する禁断の果実
1
·
·
Oct. 9, 2019, 1:14 a.m.
Summary
Pythonはクラスに後からメソッドが追加できる言語です。 class A: pass A().hello() # Traceback (most recent call last): # File "<stdin>", line 1, in <module> # AttributeError: 'A' object has no attribute 'hello' def hello(self): print("hello") setattr(A,'hello',hello) A().hello() # hello しかし、それはあく...
Read full post on chantsune.github.io →
Submit
AUTHOR
RECENT POSTS FROM THE AUTHOR