jorisvandenbossche opened a new pull request #10591:
URL: https://github.com/apache/arrow/pull/10591


   This PR does several small things:
   
   - Fix `__contains__` to not check the actual keys (and not rely on 
`__getitem__` since that also supports integers)
   - Add tests for the case of StructScalar with duplicate field names, and 
ensure some behaviours that already worked (`__getitem__` with integers, 
`__iter__`, `keys()`)
   - Changed `list(scalar)` (`__iter__`) to also return the keys for a "null" 
scalar (since we do allow `s["key"]` in that case, that seems most consistent?)
   - Changed the `repr` to use a tuple instead of dict representation. I know 
this just postpones a bit the `as_py()` discussion (should it return dict vs 
tuple?), but at least this ensures that the `repr` doesn't fail on the short 
term, and so you can inspect the object.
   - I added an explicit `items()` method (overriding the ones from Mapping), 
because the return value of this can in theory support duplicate fields, and 
this can be a way to get a list of tuples already. But, this doesn't fully 
follows the Mapping API as the return value is different (not a `dict_items` 
object).
   


-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to