Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

FWIW that comparison would’ve been identical in Python 2, where to get floating point division in Python would’ve been:

>>> 1//2



1//2 always resulted in an integer, even in Python 2, with or without "from __future__ import division". To get floating point division in Python 2, you had to convert at least on of the operands to float (much like in C or C++).

You can try it online at tio.run, they still have Python 2 among their available languages, as well as Python 3.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: