Since the one of the arguments for the decreasing order seems to just be textual representation - do we want to tweak the repr to something like
Polynomial(lambda x: 2*x**3 + 3*x**2 + x + 0)
(And add a constructor that calls the lambda with Polynomial(1))
Eric
“the intuitive way” is the decreasing powers.
An argument against this is that accessing the ith power of x is spelt:
x.coeffs[i]for increasing powersx.coeffs[-i-1]for decreasing powersThe former is far more natural than the latter, and avoids a potential off-by-one error
If I ask someone to write down the coefficients of a polynomial I don’t think anyone would start from c[2]
You wouldn’t? I’d expect to see
rather than
Sure, I’d write it starting with the highest power, but I’d still number my coefficients to match the powers.
Eric