The goal of this project is to expand the functionality of the Python 3.x standard library Fraction class to accept anything that Fraction would and more: Mixed('3 4/5') == Mixed(3,4,5) == Mixed(Fraction(19,5)) etc (see examples section in the source for full list). This class is designed to behave exactly as a standard Fraction would except that 1) it supports string constructions of mixed number fractions, 2) it supports three argument construction in the form of whole_number,numerator, denominator, and 3) the string representation is formatted in mixed number form. All the methods and properties behave the same (except as noted above) with the addition of a fnumerator property which returns the numerator of the fractional portion of the number only and the addition of a whole property which behaves as a % 1 to return only the whole number portion of the number. Why? I wanted it. Python didn't have it. So I wrote it.
Python Mixed Fractions Class
Support for mixed number fractions based on the library Fraction class
Brought to you by:
jb0x2d1
Downloads:
0 This Week