Python 2.3
François Pinard
pinard at iro.umontreal.ca
Tue Sep 10 07:27:14 EDT 2002
[JB]
> But there is probably no way to write a function f Rat x Rat
> --> Rat and then at the input prompt write f(2/3,-3/2).
You need to build some special notation for creating your rational constants.
But Python makes it quite easy to do. You could aim writing something like:
f(Rat(2, 3), Rat(-3, 2))
or if you like ultra-concision, which is excusable interactively, do:
r = Rat
f(r(2,3), r(-3,2))
--
François Pinard http://www.iro.umontreal.ca/~pinard
More information about the Python-list
mailing list