ANN: mixed 0.2

Catherine Devlin catherine.devlin at gmail.com
Sat Mar 1 02:59:04 CET 2008


introducing 'mixed', a module providing a class for handling mixed numbers
and fractions.  Parses string and float inputs and handles arithmetic
correctly.

easy_install mixed
development version: hg clone http://hg.assembla.com/mixed_pythonmixed_python
Homepage and trac: http://trac-hg.assembla.com/mixed_python/

>>> from mixed import Mixed
>>> m1 = Mixed('4 2/3')
>>> m2 = Mixed('4/10')
>>> m2.reduced()
Mixed('2/5')
>>> m1 + m2
Mixed('5 1/15')
>>> print m1 / m2
11 2/3
>>> Mixed(-1.5)
Mixed('-1 1/2')
>>> Mixed(2./3.)
Mixed('2/3')

-- 
- Catherine
http://catherinedevlin.blogspot.com/
*** PyCon 2008 * Chicago * March 13-20 * us.pycon.org ***
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-announce-list/attachments/20080229/42c2b5bc/attachment.htm 


More information about the Python-announce-list mailing list