Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Is that a "best-practice" or gnibbler's first solution below "better?" Commented Jul 8, 2013 at 16:50
  • This is best-practice. The work-around to use float() will work too, but it is basically a hack to avoid the issue. from __future__ import division is the correct way of handling this as Python 3 switches behaviour. Commented Jul 8, 2013 at 16:51
  • Can from __future__ import division be used when using ipython? Commented Jul 8, 2013 at 16:54
  • Yes, it works in ipython; it works in the standard Python console as well. Commented Jul 8, 2013 at 16:54