Dear folks,
I have some code that stopped working with 1.6.0 and I'm wondering if
there's a better way to replace it than what I came up with. Here's a
condensed version:
x = [()] # list containing an empty tuple; this isn't the only case,
but it's one that must be handled correctly
y = np.empty(len(x), dtype=object)
y[:] = x[:]
In 1.5.1 this works, giving y as "array([()], dtype=object)"
In 1.6.0, it raises a ValueError:
ValueError: output operand requires a reduction, but reduction is not
enabled
I didn't see anything in the release notes about this; admittedly it's a
very small corner case. I also don't understand what the error message
is trying to tell me here.
Most of the more straightforward ways to construct the desired array
don't work because the interpretation of a nested structure is as a
multi-dimensional array, which is reasonable.
At this point my workaround is to replace the assignment with a loop:
for i, v in enumerate(x):
y[i] = v
but this seems non-Numpyish. Any light on what the error means or a
better way to do this would be most welcome.
Thanks,
Ken
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion