You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is inconsistent with accessing a single field:
>>> arr["lkjlkj"]
Traceback (most recent call last):
File "<ipython-input-7-7a431ec24c6c>", line 1, in <module>
arr["lkjlkj"]
ValueError: field named lkjlkj not found
Furthermore, it creates error messages that can be harder to make sense of, like in:
for (x, y_value) in arr[["x", "y_valuf"]]: # Note the typo in "y_valuf"
…
This commit simplifies the code in array_subscript and
array_assign_subscript related to field access. This fixesnumpy#4806,
and also removes a potential segfaults, eg if the array is indexed using
an sequence-like object that raises an exception in getitem.
Also fixesnumpy#5631, related to creation of structured dtypes
with no fields (an unusual and probably useless edge case).
Also moves all imports in _internal.py to the top.
Fixesnumpy#4806.
Fixesnumpy#5631.
When accessing multiple records with
arr[["field0", "field1",…]]
, using a non-existing field is silent:This is inconsistent with accessing a single field:
Furthermore, it creates error messages that can be harder to make sense of, like in:
(ValueError: need more than 1 value to unpack).
I can't find any documentation on the current behavior either (it's not in http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#record-access).
I would suggest that non-existing fields raise an exception, for consistency/least-surprise and practicality reasons.
The text was updated successfully, but these errors were encountered: