Hi William,

On 2014-05-28, William Stein <wst...@gmail.com> wrote:
> With properties, guess what happens?   Suppose f.something is a
> property that's an immutable number, e.g., the determinant of a
> matrix.
>
>  sage: a = matrix(...)
>  sage: a.det?
>  docstring about integer!

That's not true, if det is a property:
 sage: class MyMatrix(object):
 ....:     @property
 ....:     def det(self):
 ....:         "Determinants are computed by..."
 ....:         return 5
 ....:     
 sage: m = MyMatrix()
 sage: m.det
 5
 sage: m.det?
 Type:       property
 String Form:<property object at 0x904b2fc>
 Docstring:  Determinants are computed by...

> And the above just makes absolutely no sense.  The user expects to get
> a docstring about a function that computes the determinant, ...

She in fact does. That's the difference between attributes and
properties.

However:

> Another issue is that frequently in math we have algorithms/options to
> functions, e.g.,
>
>   sage: a.det(algorithm="padic")
>
> Expressing the above with properties is awkward and hard to discover.

+1

Best regards,
Simon


-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to