Re: About Rational Number (PEP 239/PEP 240)

2007-12-16 Thread Mel
Steven D'Aprano wrote: > Yes, but my point (badly put, I admit) was that people find fractions far > easier to work with than they find floating point numbers. I'm not so sure. I got caught by the comic XKCD's infinite-resistor-grid thing, and simplified it to a ladder network -- call it L -

Re: About Rational Number (PEP 239/PEP 240)

2007-12-16 Thread Aahz
In article <[EMAIL PROTECTED]>, George Sakkis <[EMAIL PROTECTED]> wrote: > >Regardless, a builtin (or at least standard library) rational type >would be nice to have. Of course folks that *really need* rationals >are already using some 3rd party library, but for the rest of us it >would be an impr

Re: About Rational Number (PEP 239/PEP 240)

2007-12-16 Thread Steven D'Aprano
On Sat, 15 Dec 2007 22:20:22 -0800, Dennis Lee Bieber wrote: > On Sun, 16 Dec 2007 06:09:06 -, Steven D'Aprano > <[EMAIL PROTECTED]> declaimed the following in > comp.lang.python: > >> Yes, but my point (badly put, I admit) was that people find fractions >> far easier to work with than they f

Re: About Rational Number (PEP 239/PEP 240)

2007-12-16 Thread Lie
> Rationals are not that simple. So do complex number, in fact most people are much more familiar with rationals/fractions than with complex number. And notice that I don't use the word simple, I use the word elementary. Elementary doesn't always means simple (although it usually is), but rather i

Re: About Rational Number (PEP 239/PEP 240)

2007-12-15 Thread Steven D'Aprano
On Sat, 15 Dec 2007 17:42:26 -0800, Dennis Lee Bieber wrote: > On Sun, 16 Dec 2007 00:42:56 -, Steven D'Aprano > <[EMAIL PROTECTED]> declaimed the following in > comp.lang.python: > >> In the real world, people use fractions all the time, e.g. plumbers. >> (Not that I'm expecting plumbers to

Re: About Rational Number (PEP 239/PEP 240)

2007-12-15 Thread George Sakkis
On Dec 15, 6:52 pm, greg <[EMAIL PROTECTED]> wrote: > So while rationals might be useful to have available for > some things, you should have to explicitly ask for them. > Returning rationals from '/' applied to integers would > be a bad idea, for example. >From my reading of the PEP, it doesn't

Re: About Rational Number (PEP 239/PEP 240)

2007-12-15 Thread Steven D'Aprano
On Sat, 15 Dec 2007 15:44:26 -0800, Arnaud Delobelle wrote: > Rationals are not that simple. > > * Unless you are working under very controlled conditions, rationals > very quickly grow enormous numerators and denominators, hence require > arbitrary precision integers (which, I concede, are part

Re: About Rational Number (PEP 239/PEP 240)

2007-12-15 Thread greg
I think the main objection to rationals is that extensive computation with them tends to result in numbers requiring larger and larger amounts of storage. I believe that ABC made routine use of rationals, and this caused programs to get bogged down for no apparent reason, as rationals were being us

Re: About Rational Number (PEP 239/PEP 240)

2007-12-15 Thread Arnaud Delobelle
On Dec 15, 10:38 pm, Lie <[EMAIL PROTECTED]> wrote: [...] > > Yeah, that's why I consider them too complex for being included as a > core of a general programming language like Python. Nevertheless, > fraction datatype _IS_ elementary enough to be included as core > language feature. Rationals are

Re: About Rational Number (PEP 239/PEP 240)

2007-12-15 Thread Lie
On Dec 16, 4:55 am, "Fredrik Johansson" <[EMAIL PROTECTED]> wrote: > On Dec 15, 2007 10:05 PM, Lie <[EMAIL PROTECTED]> wrote: > > > Random ramble past here: > > Actually, my vision would be not only fractions, but also rooted > > number (square root, cube root, etc), it could be possible to > > imp

Re: About Rational Number (PEP 239/PEP 240)

2007-12-15 Thread Fredrik Johansson
On Dec 15, 2007 10:05 PM, Lie <[EMAIL PROTECTED]> wrote: > Random ramble past here: > Actually, my vision would be not only fractions, but also rooted > number (square root, cube root, etc), it could be possible to > implement a type where a number consist of a rooted number times a > multiplier pl

Re: About Rational Number (PEP 239/PEP 240)

2007-12-15 Thread Lie
The easiest implementation of using fractional datatype is probably to add a new operator. Some scientific calculators provide a special operator to signify a fraction (somewhat on the shape of a small L in mine) and I strongly believe that their internal calculation probably used fractions even w

Re: About Rational Number (PEP 239/PEP 240)

2007-12-15 Thread [EMAIL PROTECTED]
On Dec 15, 2:00 pm, Lie <[EMAIL PROTECTED]> wrote: > I'm very surprised actually, to see that Python rejected the use of > fractional/rational numbers. However, when I read the PEP, I know > exactly why the proposal was rejected: People compared fractions with > integers, while it should be more fa

About Rational Number (PEP 239/PEP 240)

2007-12-15 Thread Lie
I'm very surprised actually, to see that Python rejected the use of fractional/rational numbers. However, when I read the PEP, I know exactly why the proposal was rejected: People compared fractions with integers, while it should be more fairly compared to floats. Arguments against: - When I use t