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.

Cool. Doesn't the coercion framework end up trying all kinds of things
that may generate errors which get caught? Aren't those also different
errors that AttributeError? Shouldn't we be using a similar approach?

def LazyError(Error):
    def __init__(self,template,data):
        self._template = template
        self._data = data
    @property
    def message(self):
        return self._template%self._data

You may have a better feeling for whether having something like this
would offer a worthwhile improvement.
[this is a little different from AttributeErrorMessage: There you're
even recycling the string allocation. Here, we'd just be postponing
some possibly expensive "repr" calls and string interpolation]

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