On Fri, Apr 5, 2013 at 6:34 PM, Terry Jan Reedy <tjre...@udel.edu> wrote:

> 2. int(rational): for floats, Fractions, and Decimals, this returns the
> integral part, truncating toward 0. Decimal and float have __int__ methods.
> Fractions, to my surprise, does not, so int must use __floor__ or __round__
> as a backup.
>

It uses __trunc__, which is supposed to be the unambiguous "Yes I really
want to throw away the fractional part and risk losing information"
replacement for __int__.  int() will try __int__ first, and then __trunc__,
as per PEP 3141.

Mark
_______________________________________________
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

Reply via email to