Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork11.9k
Closed
Description
I run the following code, which is the example of "2) Tuple argument" inhttps://docs.scipy.org/doc/numpy-1.13.0/user/basics.rec.html
>>> import numpy as np>>> x = np.zeros(3, dtype=('i4',[('r','u1'), ('g','u1'), ('b','u1'), ('a','u1')]))>>> xTraceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 955, in array_repr ', ', class_name + "(") File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 521, in array2string lst = _array2string(a, options, separator, prefix) File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 363, in wrapper return f(self, *args, **kwargs) File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 392, in _array2string options['edgeitems'], summary_insert)[:-1] File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 565, in _formatArray word = format_function(a[-i]) + separator File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 886, in __call__ for field, format_function in zip(x, self.format_functions):TypeError: zip argument #1 must support iterationThen I printed some local variables:
>>> pdb.pm()> /Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py(886)__call__()-> for field, format_function in zip(x, self.format_functions):(Pdb) p x0(Pdb) u> /Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py(565)_formatArray()-> word = format_function(a[-i]) + separator(Pdb) p a.dtypedtype([('r', 'u1'), ('g', 'u1'), ('b', 'u1'), ('a', 'u1')])(Pdb) p a['r']array([0, 0, 0], dtype=uint8)(Pdb) p a[0]0Environment:
- OS: macOS 10.12.6
- Python: 3.6 on Homebrew
- Numpy: 1.12, 1.13.3, and1f4ed32
- This error didn't occur with numpy==1.11.3