[Answered ]-How to use: from __future__ import division with django

2👍

from __future__ import division has nothing to do this with this; you’re trying to divide a value by the method itself, instead of calling the method first to get a proper operand. Compare and contrast:

>>> class X(object):
...   def count(self):
...     return 1
... 
>>> x = X()
>>> 1 / x.count
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for /: 'int' and 'instancemethod'
>>> 1 / x.count()
1

Leave a comment