Ask Your Question

Revision history [back]

It's not really the function that was deprecated, but the module it was in.

The same function can now be imported from a different module.

To figure out the new import, one can have a look at

and click on the commit id in the "Branch" field to see the replacements that were made when the module was deprecated.

This is the new import:

from sage.structure.element import is_Matrix

It's not really the function that was deprecated, but the module it was in.

The same function can now be imported from a different module.

To figure out the new import, one can have a look at

and click on the commit id in the "Branch" field to see the replacements that were made when the module was deprecated.

This is the new import:

from sage.structure.element import is_Matrix

How to figure all that out from scratch:

  • try the initial import:

    sage: from sage.matrix.matrix import is_Matrix
    
  • then look at the source code of isMatrix:

    sage: is_matrix??
    
  • this tells you everything happens in the file .../sage/matrix/matrix.pyx

  • in a text editor, open the file <path_to_sage_root_folder>/src/sage/matrix/matrix.pyx

  • in this file there is a note about deprecation and a reference to Sage Trac ticket 24096

  • then see above.

It's not really the function that was deprecated, but the module it was in.

The same function can now be imported from a different module.

To figure out the new import, one can have a look at

and click on the commit id in the "Branch" field to see the replacements that were made when the module was deprecated.

This is the new import:

from sage.structure.element import is_Matrix

How to figure all that out from scratch:

  • try the initial import:

    sage: from sage.matrix.matrix import is_Matrix
    
  • then look at the source code of isMatrix:

    sage: is_matrix??
    
  • this tells you everything happens in the file .../sage/matrix/matrix.pyx

  • in a text editor, open the file <path_to_sage_root_folder>/src/sage/matrix/matrix.pyx

  • in this file there is a note about deprecation and a reference to Sage Trac ticket 24096

  • then see above.

Simpler way to test if something is a matrix:

sage: A = matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
sage: isinstance(A, sage.structure.element.Matrix)
True