[Python-Dev] Re: PEP239 (Rational Numbers) Reference Implementation and new issues (original) (raw)
Oren Tirosh oren-py-d@hishome.net
Tue, 8 Oct 2002 12:03:51 -0400
- Previous message: [Python-Dev] Re: PEP239 (Rational Numbers) Reference Implementation and new issues
- Next message: [Python-Dev] Re: PEP239 (Rational Numbers) Reference Implementation and new issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Oct 08, 2002 at 03:55:49PM +0200, Thomas Wouters wrote:
I'd also say rational-literals are not that important. Looking at my own Python code, I very rarely need a floating-point literal to start with. Strings, plenty, dicts and lists fairly often, integers every now and then, but floating point numbers very rarely, and almost all of them are just '0.0' or an integer expressed as float to force float-division. Most of my float objects come from (library) functions that return them.
Having nice-looking literals is important even if they are not actually typed in the source code too often. The literal form is also the repr() for all built-in numeric types so far. I don't think we should break that.
What would your like to see as the repr() of a rational number? The answer to this will also determine what you type in your source.
Note that repr(n) is not necessarily str(n):
repr(f) '0.59999999999999998' str(f) '0.6'
So we could have:
repr(r) '3/5r' # or 'rat(3, 6)' str(r) '3/5'
Oren
- Previous message: [Python-Dev] Re: PEP239 (Rational Numbers) Reference Implementation and new issues
- Next message: [Python-Dev] Re: PEP239 (Rational Numbers) Reference Implementation and new issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]