title: function as constructor parameter in python
body: <p>Can a function be used as a parameter of the python <code>__init__</code> method? </p>
  
  <p>What I'm trying to do is write a class for both the perceptron and logistic regression learning algorithms. As their training functions are very similar, and only really differ by the function used for prediction, it would be nice to be able to specify this function function at construction. </p>
  
  <p>I hope this question hasn't been asked before (I've searched, haven't found anything; maybe I'm searching for the wrong topic). An example would be great. I'm not that familiar with <code>lambda</code>, so please provide some justification for any advanced python features. Thanks!</p>