cniehaus (cniehaus) wrote,
cniehaus
cniehaus

Casting an int to a float in Python 2.6

Moin

Does


%d / %d is %f" % (num1, num2, float(num1)/num2)


have any (dis)advantages over


%d / %d is %f" % (num1, num2, float(num1)/float(num2))


? Both work. If one number is a float both are treated as a float, as far as I know.

Does the first line have any (technical) disadvantages over the second?

Subscribe

  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 22 comments