introducing &#39;mixed&#39;, a module providing a class for handling mixed numbers and fractions.&nbsp; Parses string and float inputs and handles arithmetic correctly.<br><br>easy_install mixed<br>development version: hg clone <a href="http://hg.assembla.com/mixed_python">http://hg.assembla.com/mixed_python</a> mixed_python<br>
Homepage and trac: <a href="http://trac-hg.assembla.com/mixed_python/">http://trac-hg.assembla.com/mixed_python/</a><br clear="all"><br><pre class="wiki">&gt;&gt;&gt; from mixed import Mixed<br>&gt;&gt;&gt; m1 = Mixed(&#39;4 2/3&#39;)<br>
&gt;&gt;&gt; m2 = Mixed(&#39;4/10&#39;)<br>&gt;&gt;&gt; m2.reduced()<br>Mixed(&#39;2/5&#39;)<br>&gt;&gt;&gt; m1 + m2<br>Mixed(&#39;5 1/15&#39;)<br>&gt;&gt;&gt; print m1 / m2<br>11 2/3<br>&gt;&gt;&gt; Mixed(-1.5)<br>Mixed(&#39;-1 1/2&#39;)<br>
&gt;&gt;&gt; Mixed(2./3.)<br>Mixed(&#39;2/3&#39;)<br><br></pre>-- <br>- Catherine<br><a href="http://catherinedevlin.blogspot.com/">http://catherinedevlin.blogspot.com/</a><br>*** PyCon 2008 * Chicago * March 13-20 * <a href="http://us.pycon.org">us.pycon.org</a> ***