How about adding rational fraction to Python?

Paul Rubin http
Sun Mar 2 10:02:29 EST 2008


Lie <Lie.1296 at gmail.com> writes:
> That's quite complex and restrictive, but probably it's because my
> mind is not tuned to Haskell yet.

That aspect is pretty straightforward, other parts like only being
able to do i/o in functions having a special type are much more confusing.

> Anyway, I don't think Python should
> work that way, because Python have a plan for numerical integration
> which would unify all numerical types into an apparent single type,
> which requires removal of operator's limitations.

Well I think the idea is to have a hierarchy of nested numeric types,
not a single type.

> from __future import division
> a = 10
> b = 5
> c = a / b
> if c * b == a: print 'multiplication is inverse of division'

Try with a=7, b=25




More information about the Python-list mailing list