pitrou commented on code in PR #36745:
URL: https://github.com/apache/arrow/pull/36745#discussion_r1269138177
##########
python/pyarrow/scalar.pxi:
##########
@@ -791,8 +791,11 @@ cdef class MapScalar(ListScalar):
"""
Iterate over this element's values.
"""
+ return self
+
+ def __next__(self):
arr = self.values
- if array is None:
+ if arr is None:
raise StopIteration
for k, v in zip(arr.field('key'), arr.field('value')):
yield (k.as_py(), v.as_py())
Review Comment:
Do you actually test these changes before pushing them?
You can't use `yield` in a `__next__` function.
Either you write `__iter__` as a generator (using `yield`), or you write a
pair of `__iter__` and `__next__` functions (without `yield`). You can't mix
the two styles.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]