On Friday, October 10, 2014 1:54:37 PM UTC-7, Dan Drake wrote:
>
> For objects that have lots of methods, it's not very easy to find one by
> doing
>
> X.<TAB>
>
> since there's just so much. In analogy with search_def, search_src, etc,
> I wish there was, say, search_methods. On a matrix, for example:
>
> search_methods(A, 'eigen')
>
> which would, in effect, do
>
> A.<TAB> | grep eigen
>
> and give me
>
> A.eigenmatrix_left
> A.eigenmatrix_right
> A.eigenspaces_left
> A.eigenspaces_right
> A.eigenvalues
> A.eigenvectors_left
> A.eigenvectors_right
> A.left_eigenmatrix
> A.left_eigenspaces
> A.left_eigenvectors
> A.right_eigenmatrix
> A.right_eigenspaces
> A.right_eigenvectors
>
> I suspect there's a trac ticket related to this but I'm too lazy at the
> moment to find it. (But not, evidently, too lazy to complain about
> the issue...)
>
>
You could do this:
sage: [_ for _ in dir(A) if _.find('eigen') != -1]
['_eigenspace_format',
'eigenmatrix_left',
'eigenmatrix_right',
'eigenspaces_left',
'eigenspaces_right',
'eigenvalues',
'eigenvectors_left',
'eigenvectors_right',
'left_eigenmatrix',
'left_eigenspaces',
'left_eigenvectors',
'right_eigenmatrix',
'right_eigenspaces',
'right_eigenvectors']
Oh, wait: I just discovered the IPython magic function 'psearch'. I think
this is the right way to do it:
sage: %psearch A.*eigen*
A.eigenmatrix_left
A.eigenmatrix_right
A.eigenspaces_left
A.eigenspaces_right
A.eigenvalues
A.eigenvectors_left
A.eigenvectors_right
A.left_eigenmatrix
A.left_eigenspaces
A.left_eigenvectors
A.right_eigenmatrix
A.right_eigenspaces
A.right_eigenvectors
That's pretty cool, at least if I can remember it...
John
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.