2008/1/24, Guido van Rossum <[EMAIL PROTECTED]>: > > So you won't be able to construct an int from a float? That sucks (and > > is unintuitive). > > Yes, you can, but you have to specify how you want it done by using > trunc() or round() or ceil() or floor(). (In 3.0, round(x) will return > an int, not a float.)
2008/1/24, Jeffrey Yasskin <[EMAIL PROTECTED]>: > That needs to be updated and implemented. I think the decision was > that removing float.__int__() would break too much, so it needs a > deprecation warning in 3.0. What I understand here is as int() is "ambiguous", in the future if you want to specify how you want to convert a float to int. But ceil and floor returns a float. And round and trunc will return an int. So, how I could convert a float to its upper int? Like this?: >>> trunc(math.ceil(.3)) 1 BTW, int is not giving me a deprecation warning: >>> int(.1) 0 Thanks! -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com