Mark Dickinson <dicki...@gmail.com> added the comment: Hmm. That patch isn't quite right, in at least two respects
- if the single-argument constructor is using LBYL (i.e., an explicit isinstance(x, Rational), then the two-argument constructor should too. - the zero-division check should come *after* the type check; that is, Rational(1, 0j) should raise TypeError rather than ZeroDivisionError. Here's an updated version, that also makes the default second argument None rather than 1 and uses an 'is None' instead of '== 1' to determine number of arguments; this means that Fraction(3, 1.0) is no longer valid. ---------- Added file: http://bugs.python.org/file13742/fraction_of_fractions2.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5812> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com