cniehaus (cniehaus) wrote,

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?

  • Post a new comment

    Error

    default userpic

    Your reply will be screened

  • 22 comments