Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello, @mocha! You should be very careful about Python data types and Sage data types. In particular, int is a Python data type, but sage.rings.integer.Integer is a Sage data type. Although they behave quite similarly, there are differences. For example, try int(5).is_prime(), which produces an error because uses int instead of Integer.

Anyway, you could create a module my_data_types.py where you define, for example, svector = sage.modules.vector_integer_dense.Vector_integer_dense. I suggest using the Union() function from the typing module to create a more complete svector type that also includes sage.modules.free_module_element.FreeModuleElement_generic_dense and other Sage vector types. Finally, just make something like from my_data_types import svector.