On Tue, Nov 23, 2010 at 11:37 AM, David Roe <r...@math.harvard.edu> wrote: > I think that while we're still using Python 2.x, where 2r/3r = 0, we > absolutely need the preparser.
Yes. Without it, it is far to easy to type something like x^3 + 2*x^2 - 1/2*x + 5/3 and having that give x^3 + 2*x^2 + 1 would be a total disaster. However, even with Python 3, the situation won't be much better, due to 2/3 giving 0.666666... (and this isn't customizable). William > The coercion framework can work with Python > ints just fine: it's the automatic rounding that kills us. Much better > speed for large integers is another benefit that you mentioned. Also, there > are lots of number theoretic functions available on sage integers and not on > Python ints. So currently > sage: 15.factor() > works. > > If you're frustrated with the preparser, I'd suggest adding > preparser(off) > to $HOME/.sage/init.sage > David > > On Tue, Nov 23, 2010 at 19:37, Dan Christensen <j...@uwo.ca> wrote: >> >> John Cremona <john.crem...@gmail.com> writes: >> >> > There is a lesson to be learned here, which is in fact very similar to >> > one which William explained very well recently: beware the Sage >> > preprocessor which converts every integer it sees to an Integer, which >> > can have serious performance consequences and is often not necessary! >> >> I've often been quite frustrated by this aspect of the preparser. Not >> only does it frequently have speed issues, even for trivial things like >> comparing an Integer to the length of a sequence, it also can cause >> problems when calling functions from other libraries which expect a >> python int and can't handle getting an Integer. Moreover, it is so >> transparent most of the time that it is a surprise to beginners and >> sometimes even to people who aren't so new. >> >> What would be the consequence of having sage use python int's by >> default? Could sage do the conversion to Integer just when needed? >> And when is it needed? Is it just for speeding up arithmetic with >> large integers, or is it also to help with the coercion framework? >> Or is the main reason so that 1/2 works? >> >> I know this has been discussed before, but I think it's worth thinking >> again about whether defaulting to python int's might be better. >> >> Dan >> >> -- >> To post to this group, send an email to sage-devel@googlegroups.com >> To unsubscribe from this group, send an email to >> sage-devel+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/sage-devel >> URL: http://www.sagemath.org > > -- > To post to this group, send an email to sage-devel@googlegroups.com > To unsubscribe from this group, send an email to > sage-devel+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/sage-devel > URL: http://www.sagemath.org > -- William Stein Professor of Mathematics University of Washington http://wstein.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org