ANN: Experimental Number Types (Integer, Rational, Floats)
M.-A. Lemburg
mal at lemburg.com
Sun Apr 22 14:08:08 EDT 2001
"John W. Baxter" wrote:
>
> In article <mailman.987763770.10861.python-list at python.org>, M.-A.
> Lemburg <mal at lemburg.com> wrote:
>
> > "John W. Baxter" wrote:
> > >
> > > In article <mailman.987707135.9028.python-list at python.org>, M.-A.
> > > Lemburg <mal at lemburg.com> wrote:
> > >
> > > > I'm sure this proof of
> > > > concept will raise a few more questions regarding the
> > > > usefulness of switching to rationals for literals like
> > > > 1.123.
> > >
> > > I might be more tempted to create a Rational containing 1.123 by writing
> > > Rational(1123, 1000). (Not to mention the opportunities for
> > > obfuscation: Rational(2246, 2000) being just a non-obscure one.
> > >
> > > And Paul makes a good case for Rational("1.123") I think.
> >
> > Well, Moshe's plan is to have 1.123 result in a Rational(1123, 1000)
> > being created (instead of a Python float). The extension should
> > make playing with this idea a whole lot easier.
>
> I was trying to post a (mild) dissent from that plan. It produces a
> change in the value produced by an unchanged bit of code, namely 1.123,
> since Rational (1123,1000) isn't equal in value to the present meaning
> of 1.123. Had Guido started off with Rational as the result of writing
> 1.123, I would like that, but that's not where we are [and this
> sentence isn't meant to criticize Guido's choice].
True.
The usual procedure for these kind of incompabtible changes can be
found in PEP 5 PEP 236 (see http://python.sourceforge.net): If
this change should go into the core, then you'll have at least
24 months to adapt to it before a Python uses the new feature
as default (and then only if you upgrade to the latest version ;-).
--
Marc-Andre Lemburg
______________________________________________________________________
Company & Consulting: http://www.egenix.com/
Python Pages: http://www.lemburg.com/python/
More information about the Python-list
mailing list