Just out of curiosity does anyone know why you get a deprecation warning if
you pass a float to range but if you use round, which returns a float, there
is no warning?

Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)]
on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> range(2.0)
__main__:1: DeprecationWarning: integer argument expected, got float
[0, 1]
>>> range(round(2.0))
[0, 1]
>>> round(2.0)
2.0
>>> round(2.0, 0)
2.0
>>> round.__doc__
'round(number[, ndigits]) -> floating point number\n\nRound a number to a
given
precision in decimal digits (default 0 digits).\nThis always returns a
floating
point number.  Precision may be negative.'
>>>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to