title: python/flask TypeError: 'float' object is not callable
body: <p>I'm deploying simple API written in python (Flask), but I get weird error "TypeError: 'float' object is not callable". However, object is int type, what I confirmed. I tried even enforcing int type by "for counter in range(int(additional_params_count)):" but it didn't help.</p>
  
  <p>Below is the error message and source</p>
  
  <pre><code> 1
   &lt;type 'int'&gt;
   [20130826-16:14PM] [flats_api] [ERROR] Exception on /v1/closest_point [GET]
   Traceback (most recent call last):
     File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
       response = self.full_dispatch_request()
     File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
       rv = self.handle_user_exception(e)
     File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
       reraise(exc_type, exc_value, tb)
     File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
       rv = self.dispatch_request()
     File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
       return self.view_functions[rule.endpoint](**req.view_args)
     File "/var/www/flats_api/flats_api.py", line 104, in closest_point
       for counter in range(0,additional_params_count):
   TypeError: 'float' object is not callable
  </code></pre>
  
  <p>source:</p>
  
  <pre><code>def closest_point():
           lng = request.args.get('lng', default=None, type=float)
           lat = request.args.get('lat', default=None, type=float)
  
           price_min = request.args.get('price_min',default=None, type=float)
           price_max = request.args.get('price_max',default=None, type=float)
  
           rooms_min = request.args.get('rooms_min',default=None, type=float)
           rooms_max = request.args.get('rooms_max',default=None, type=float)
  
           if (lng != None) and (lat != None):
                   range = 0.1
                   lng_min = lng - range
                   lng_max = lng + range
                   lat_min = lat - range
                   lat_max = lat + range
  
                   cur = g.db.cursor()
                   query = "SELECT id, link, price, longitude, latitude FROM " + DATABASE_TABLE_NAME + " WHERE latitude &gt;= " + str(lat_min) + " AND latitude &lt;= " + str(lat_max) + " AND longitude &gt;= " + str(lng_min) + " AND longitude &lt;= " + str(lng_max)
  
                   # I always have 5 basic parameters to group by. I count number of additional parameters to know how many to add
                   additional_params_count = 0
                   if price_min:
                           query = query + " AND price &gt;= " + str(price_min)
                           additional_params_count = additional_params_count + 1
                   query = query + "GROUP BY 1,2,3,4,5"
                   print additional_params_count
                   print type(additional_params_count)
                   for counter in range(0,additional_params_count):
                           print counter
                           query = query + "," + str(counter + 6)
                   query = query + ";"
                   print query
                   cur.execute(query)
                   columns = [desc[0] for desc in cur.description]
                   rows = cur.fetchall()
                   flats_json = []
                   for row in rows:
                           flats_json.append(dict((k,str(v)) for k,v in zip(columns,row)))
                   response_body = str(rows)
                   return json.dumps(flats_json)
           else:
                   return "One of lng or lat parameters missing"
  </code></pre>