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.  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

Also, please _do_ report any issues with speed, external libraries,
etc., that come up.
As you can see above with ticket
http://trac.sagemath.org/sage_trac/ticket/10314 we do care, and will
try to address them!

Regarding loading scripts from the command line and get preparsing, I do either:

sage: load foo.sage

or

sage: attach foo.sage

The nice thing about attach is the file gets auto-reloaded any time it changes.

You can also load python files, e.g., "load foo.py" or "attach
foo.py", and the file won't be preparsed.

 -- William


>
> 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

Reply via email to