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*

5
  • 3
    And in Smalltalk, for example, it will neither result in an integer nor a float, but in a rational. Commented Nov 7, 2023 at 23:42
  • 5
    I'll add that the Python "Int divided by Int = Float" is relatively new, even for Python - Python 2.x used the "Int divided by Int = Int" approach, and it's 3.x that changed it. Commented Nov 8, 2023 at 5:37
  • 2
    (On that note, the documentation of the change can be found here, in PEP-238). Commented Nov 8, 2023 at 5:41
  • 4
    The tl;dr; is that Python doesn't have integer variables, only integer objects. In python 2.x you can't tell what a/b means. In C and Java you can look at the declaration of a and b to know the type. Commented Nov 8, 2023 at 9:13
  • 2
    @AlexanderThe1st Thanks for that. I'll update the answer. Commented Nov 8, 2023 at 16:11