I need a numpy matrix with comparisons among all elements in a sequence:
from numpy import matrix
seq = [0, 1, 2, 3]
matrix([[cmp(a, b) for a in seq] for b in seq])
I'd like to know if there is a better way to do this.
|
Why are you using As for a better way:
| |||
|