title: TypeError: list object is not an iterator
body: <p>Am trying to make a simple post api in flask-python but am getting this error :</p>
  
  <pre><code>TypeError: list object is not an iterator
  </code></pre>
  
  <p>but when i revise my code seems fine what could be the problem.</p>
  
  <p>My function which specifically has the problem:</p>
  
  <pre><code>def post(self,name):
          #return {'message': name}
          item = next(filter(lambda x: x['name'] == name, items), None)
          if item:
              return {'message':"An item with name '{}' already exixts. ".format(name)},400
          data = request.get_json()
          item = {'name': name, 'price':data['price']}
          items.append(item)
          return item, 201
  </code></pre>
  
  <p>When i try to post something on <strong>postman</strong> i get this <code>logcat</code> <strong>error</strong>:</p>
  
  <pre><code>[2018-06-07 10:41:02,849] ERROR in app: Exception on /item/test [POST]
  Traceback (most recent call last):
    File "C:\Python27\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
      rv = self.dispatch_request()
    File "C:\Python27\lib\site-packages\flask\app.py", line 1598, in dispatch_request
      return self.view_functions[rule.endpoint](**req.view_args)
    File "C:\Python27\lib\site-packages\flask_restful\__init__.py", line 480, in wrapper
      resp = resource(*args, **kwargs)
    File "C:\Python27\lib\site-packages\flask\views.py", line 84, in view
      return self.dispatch_request(*args, **kwargs)
    File "C:\Python27\lib\site-packages\flask_restful\__init__.py", line 595, in dispatch_request
      resp = meth(*args, **kwargs)
    File "G:\flask_workspace\MealBookingApp\MealBookingApp\MealBookingApp\views.py", line 30, in post
      item = next(filter(lambda x: x['name'] == name, items), None)
  TypeError: list object is not an iterator
  127.0.0.1 - - [07/Jun/2018 10:41:02] "POST /item/test HTTP/1.1" 500 -
  </code></pre>
  
  <p><strong>NB:</strong></p>
  
  <p><strong><em>line 30</em></strong> , is the line below :</p>
  
  <pre><code>item = next(filter(lambda x: x['name'] == name, items), None)
  </code></pre>