I'm relying on the fact that __getattr__ is only called if the attribute is 
missing from the matrix class. I was of the opinion that this would 
completely avoid raising an AttributeError in the first place. This 
(should?) mean that the currently defined simplify_ methods on the matrices 
will still be called without touching __getattr__, and __getattr__ can focus 
on trying to return the mapped result.

However, I've found with my experimentation, that using __getattr__ to 
dynamically wrap a method results in the following:
>>> amatrix.amethod(aparameter)
results in python looking for an attribute called amethod in amatrix
python fails to find amethod, so it runs amatrix.__getattr__(self, 
'amethod')
amatrix.__getattr__ returns an object to python, let's call it getted
Then (and this is what's giving me hiccups) python calls the returned object 
with the parameters, like this getted(aparameter)

The output of __getattr__ has to be a callable. And when called, it has to 
return a matrix object with the mapped values of the original matrix.
I'm thinking it's going to involve a helper function. o_O

Joal Heagney

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to