2017-06-06 4 views
1

私は抽出と比較のさまざまな方法を選択できるAPIを構築しようとしています。各メソッドには独自のパラメータセットがあります。私はあなたがarbitrary argument listsを探していると思う引数を使用して関数を選択するAPIを作成する方法

class ThisObject(object): 
    def __init__(self, input_file, extraction_method, analyses_method): 
     self.input_file = input_file 

     extracted_info = extraction_method(input_file, **parameters1**) 
     analyzed_info = analyses_method(extracted_info) 


this_object = ThisObject(input_file='~/some_file', 
         extraction_method=extraction_method.get_first_name(**parameters**), 
         analyses_method=analyses_method.get_percent_matrix(**parameters**) 
         ) 

答えて

0

:何がこのような何かを行うための最も神託とクリーンな方法だろう。

関連する問題