[Guido van Rossum] >> But _maybe_ it could be more tractable at the lexical level without >> bringing too much confusion, and for numerical _constants_ only -- 3:2 is >> one number, has never been two. > > I think the slice notation e.g. x[1:4] kills that idea. And it kills it dead indeed, at least, in my opinion. [M.-A. Lemburg] > Are you sure that you really want a special syntax for this > rather than just a simply constructor like rat(2,3) ? This is what I currently do whenever I need rationals. It might not be as elegant as the `:' would have been, but it works well in practice. I guess I would prefer ^rat(2, 3)" over any non-elegant or non-natural notation for rational constants. We do not necessarily ought to have a special notation hardwired in Python syntax. If Guido was adding complex numbers today instead of long ago, I wonder if he would allow a special notation for them, or just suggest a constructor. > Note that intution isn't going to help here because you are missing a > precision indicator. mxNumber has a constructor called FareyRational() > which converts floats to rationals: [...] Interesting, I'll save it. I use continued fraction expansion to get the "best" rational fitting a float within a tolerance, and wonder how Farey will be similar/different. Tim will surely tell us, out of his head! :-) -- François Pinard http://www.iro.umontreal.ca/~pinard
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4