Nested function calls and missing input parameter, python

I'm trying out some Text Classification tutorials here:

I don't understand the function calls in line 59 -- 65:

#creates a feature selection mechanism that uses all words
def make_full_dict(words):
    return dict([(word, True) for word in words])

#tries using all words as the feature selection mechanism
print 'using all words as features'
evaluate_features(make_full_dict)

Shouldn't make_full_dict be called with a string input value for words?

Answers


Without further context, it is a bit difficult to give a complete answer to your question. It seems that the evaluate_features method takes a function as parameter; in that case, you don't need to call the function which was passed in as a parameter. Only evaluate_features should do that. If you call the function, then the return value of the function is what evaluate_features will get, rather than the function itself

If you want to see what that function is doing, add some print statements in the make_full_dict method which will help you see what words were passed to it


Need Your Help

What's the proper way to handle an RAII member variable?

c++ class pointers constructor raii

I'm new to C++ and don't yet fully understand the RAII pattern. I'm writing a class which uses an sqlite database via SQLiteC++. Here is some sample code that uses the database that works:

Cant move saved .mov file to the photo roll

ios objective-c unity3d

I have a library which records a video and saves it to the iPad. After it is saved I want to move it into the photo library but I cannot get this to work.