title: 'NoneType' object does not support item assignment inside __init__
body: <p>I'm learning machine learning from <a href="https://www.kaggle.com/blazetama/introduction-to-ensembling-stacking-in-python" rel="nofollow noreferrer">this tutorial</a> on Kaggle.</p>
  
  <p>I try to modify the project structure so I create a new <code>.py</code> file to create a new class. This is the class :</p>
  
  <pre><code>class ModelHelper(object):
      def __init__(self, model, seed=0, params=None):
          params['random_state'] = seed # TypeError: 'NoneType' object does not support item assignment
          self.model = model(**params)
  
      def train(self, x_train, y_train):
          self.model.fit(x_train, y_train)
  
      def predict(self, x):
          return self.model.predict(x)
  
      def fit(self, x, y):
          return self.model.fit(x, y)
  
      def feature_importances(self, x, y):
          print(self.model.fit(x, y).feature_importances_)
  </code></pre>
  
  <p>And this is how i used it :</p>
  
  <pre><code>from helper import ModelHelper
  
  log_reg = ModelHelper(model=LogisticRegression);
  </code></pre>
  
  <p>This is the full error that I got :</p>
  
  <pre><code>Traceback (most recent call last):
    File "F:/backup/PycharmProjects/KaggleTitanic/DataAnalysis.py", line 191, in &lt;module&gt;
      log_reg = ModelHelper(model=LogisticRegression);
    File "F:\backup\PycharmProjects\KaggleTitanic\ModelHelper.py", line 3, in __init__
      params['random_state'] = seed # TypeError: 'NoneType' object does not support item assignment
  TypeError: 'NoneType' object does not support item assignment
  </code></pre>
  
  <p>Probably the error caused by <code>params=None</code> in my <code>__init__</code> parameter. What I want is to make this <code>params</code> field optional (I don’t have to pass it if I don’t want to)</p>