docstring JavaDocと違い,フォーマットが複数存在 Googleスタイル,numpyスタイルなど TIPS: 事前にdocstringのスタイルを決めておく! # Google Style def function_with_pep484_type_annotations(param1: int, param2: str) -> bool: """Example function with PEP 484 type annotations. Args: param1: The first parameter. param2: The second parameter. Returns: The return value. True for success, False otherwise. """
• インターフェースなくても同じ関数が定義されていればポリモーフィズムを実現可能 "If it walks like a duck and quacks like a duck, it must be a duck“ (もしもそれがアヒルのように歩き、アヒルのように鳴くのなら、それはアヒルに違いない) class AbstractHello(metaclass=ABCMeta): @abstractmethod def hello(self): pass TIPS: ダックタイピングはJavaにはない概念!