エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
method chaining in python
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
method chaining in python
(not to be confused with itertools.chain) I was reading the following: http://en.wikipedia.org/wi... (not to be confused with itertools.chain) I was reading the following: http://en.wikipedia.org/wiki/Method_chaining My question is: what is the best way to implement method chaining in python? Here is my attempt: class chain(): def __init__(self, my_object): self.o = my_object def __getattr__(self, attr): x = getattr(self.o, attr) if hasattr(x, '__call__'): method = x return lambda *args: self if

