Stefan Krah added the comment: The clear winner for float and Decimal is hasattr(x, 'as_integer_ratio'). The other types are a bit disadvantaged if the lookup fails, but they go through additional try/excepts anyway.
---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25974> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com