Is there a reliable way to check if an object is a vector?
I'm want to check if a given sage object obj
is a vector or not. I'd like to do this as efficiently as possible. Currently my best idea is:
sage_input(obj).__repr__().startswith('vector')
This works, assuming that sage_input
is smart enough to identify every vector without false positives. However, this solution feels inefficient (and also inelegant!). Is there a better way?