[SciPy-User] idiom for iterators, expr(T) if isscalar(T) else array([expr(t) for t in T])
Mon Oct 12 09:42:21 CDT 2009
Some vectors are iterators: I want
expr(T) if isscalar(T) \
else array([expr(t) for t in T])
Is there an idiom for this ?
# ValueError: shape mismatch: objects cannot be broadcast to a
array([ expr(t) for t in T ])
but this is ugly, and probably wrong in some cases even with no
I'm afraid the broadcasting rules are just too complex for me /
I'm too simple for the rules.
For a real example, see spline_2p2s in the thread "Forced derivative
More information about the SciPy-User