[New-bugs-announce] [issue6601] Fractions do not support other Fractions as numerators or denominators

Alexander Myodov report at bugs.python.org
Thu Jul 30 11:33:15 CEST 2009


New submission from Alexander Myodov <amyodov at gmail.com>:

Occurs in 2.6, doesn't occur in 3.1.
Example:

Python 2.6.2+ (release26-maint, Jun 23 2009, 07:08:39)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from fractions import Fraction
>>> Fraction(Fraction(3,5), Fraction(1,2))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/fractions.py", line 99, in __new__
    numerator = operator.index(numerator)
TypeError: 'Fraction' object cannot be interpreted as an index


Compare:

Python 3.1 (r31:73572, Jul 23 2009, 23:41:26)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from fractions import Fraction
>>> Fraction(Fraction(3,5), Fraction(1,2))
Fraction(6, 5)

----------
messages: 91088
nosy: honeyman
severity: normal
status: open
title: Fractions do not support other Fractions as numerators or denominators
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6601>
_______________________________________


More information about the New-bugs-announce mailing list