I have got a function that sets features and want to have two versions of it. One takes all features and splits them into words and phrases and the second one receives already split words and phrases as arguments
def set_features_2(self, words, phrases):
self.vocabulary = set(words)
self.phrases = SortedSet(phrases)
def set_features(self, features):
phrases = [f for f in features if ' ' in f]
words = [f for f in features if f not in phrases]
self.set_features_2(words, phrases)
What is the easiest way to remove this duplication? Both of them should be called "set_features" but both receive a different set of arguments. I know that it is possible to use args and kwargs but it is an overkill for such as trivial case.
words,phrases, andfeatureparameters and give them default values ofNonethen check to see what got passed before processing.?