[issue1682] Move Demo/classes/Rat.py to Lib/fractions.py and fix it up.
report at bugs.python.org
Mon Jun 30 23:37:38 CEST 2008
Mark Dickinson <dickinsm at gmail.com> added the comment:
> I agree that if the type of the 2nd arg isn't int or long it should be
> rejected. That should not slow down the common path (two ints).
I'm having second thoughts about this; it doesn't seem worth adding an
extra check that has to be applied every time a Fraction is created from a
string (or another Rational instance). The condition being checked for (a
denominator equal to 1, but not of type int or long) is unlikely to occur
in practice, and fairly harmless even if it does occur. So I'm thinking
that PBP says leave it alone.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list