On Wed, Dec 10, 2008 at 8:27 PM, Guido van Rossum gu...@python.org wrote:
SNIP
Fortunately Python supports a way of overloading binary operators
where it is sufficient if *one* of the operands knows how to deal with
the other. So Fraction(3, 4) * 2j happily returns 1.5j. You don't have
to
On Wed, Dec 10, 2008 at 6:47 PM, kirby urner kirby.ur...@gmail.com wrote:
SNIP
fractions.Fraction, on the other hand, barfs on anything but integers,
isn't trying to be all divisions to all possible types, isn't
pretending this is Mathematica or a generic CAS.
Note that I'm not
But fractions *can* eat fractions. Instead of Fraction(f1, f2) you
just write f1/f2. In general you should just stick to the latter, and
leave the Fraction() constructor for when the / operator would pick a
different type (as in 1/2, which becomes a float). You can also write
it as Fraction(1) /
Ah so...
My focus on the constructor as a way to trigger the initial division
(complete with gcd), was blinding me to the role of the __div__
operator in gluing the things together. I need to get back to those
continued fraction studies then, using my new understanding.
Thank you for opening my
Of kirby urner
[kirby.ur...@gmail.com]
Sent: Wednesday, December 10, 2008 10:39 PM
To: edu-sig@python.org
Subject: Re: [Edu-sig] computer algebra
On Wed, Dec 10, 2008 at 8:27 PM, Guido van Rossum gu...@python.org wrote:
SNIP
There are different schools of thought about this actually. I
So I've been yakking with Ian (tizard.stanford.edu) re the new
fractions.py, installed in Standard Library per 2.6, saw it demoed at
a recent user group meeting (PPUG).
Python's __div__ is similar to Mathematica's computer algebra notion
of division in that you're free to divide any type by any
On Wed, Dec 10, 2008 at 6:47 PM, kirby urner [EMAIL PROTECTED] wrote:
So I've been yakking with Ian (tizard.stanford.edu) re the new
fractions.py, installed in Standard Library per 2.6, saw it demoed at
a recent user group meeting (PPUG).
Python's __div__ is similar to Mathematica's computer
On Wed, Dec 10, 2008 at 8:27 PM, Guido van Rossum [EMAIL PROTECTED] wrote:
SNIP
There are different schools of thought about this actually. I don't
think pride comes into it.
Well, *my* school is quite pompous about it. We think open oh is for sissies.
But that's just us (quirky).
From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of kirby urner [EMAIL
PROTECTED]
Sent: Wednesday, December 10, 2008 10:39 PM
To: edu-sig@python.org
Subject: Re: [Edu-sig] computer algebra
On Wed, Dec 10, 2008 at 8:27 PM, Guido van Rossum [EMAIL PROTECTED