On 12 ago, 11:38, Jason Grout <jason-s...@creativetrax.com> wrote: > > Well, there is a general trend towards using functions instead of > attributes in Sage. I think the main reason is for documentation (I > wish python had attribute docstrings that we could query!). >
They wouldn't be attributes (that would involve having several copies of the matrix data in the object), they would rather be properties. A property is a method that looks like an attribute (it doesn't use parenthesis), but calls a function each time it's used. Example: sage: class Foo: ....: @property ....: def bar(self): ....: """This is a function that returns 'hello'.""" ....: return 'hello' ....: sage: a=Foo() sage: a.bar 'hello' sage: a.bar? Type: property Base Class: <type 'property'> String Form: <property object at 0xb2822fc> Namespace: Interactive Docstring: This is a function that returns 'hello'. (...) -- 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