On May 14, 2:52 pm, Nils Bruin <nbr...@sfu.ca> wrote:
> On May 14, 2:13 pm, Simon King <simon.k...@uni-jena.de> wrote:
>
> > There is a lazy object specially designed for attribute errors. See
> > sage.structure.misc.AttributeErrorMessage.

We already have a tool for delaying string assembly and it indeed
makes a difference in creating Exception objects:

sage: from sage.misc.lazy_string import lazy_string
sage: f=lambda op,A,B:"unsupported operand parent(s) for '%s': '%s'
and '%s'"%(op,A,B)
sage: R= GF(5)
sage: S= GF(3)
sage: %timeit Exception(lazy_string(f, '+', R, S))
1000000 loops, best of 3: 872 ns per loop
sage: %timeit Exception("unsupported operand parent(s) for '%s': '%s'
and '%s'"%('+',R,S))
100000 loops, best of 3: 4.35 us per loop

We don't seem to be making any use of it. Perhaps we should.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to