-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for accessing nested items in BoxList using numpy-style tuple indexing. #266
Conversation
…tyle tuple indexing.
@cdgriffith Could you approve the workflow review, please? |
This would need a new feature flag if added. As tuples are supported dictionary characters themselves. Consider: from box import Box
bx = Box({0: {1: {2: {3: 3}}}, (0, 1, 2, 3): 4})
print(bx[0,1,2,3])
# 4 |
I have implemented this feature only in the bx = Box({0: {1: {2: {3: 3}}}, (0, 1, 2, 3): 4})
assert bx[0, 1, 2, 3] == 4 But I will add some error messages to make it more user-friendly. |
My code only works for |
@cdgriffith Do you think there are any other problems with the code? |
I don't know how to program with PyPy, and I can't provide an equivalent version of it. |
Sorry for delay, I like the addition! The pypy things is failing even on master as of now, need to sort that out so no something with this code. |
* Adding #266 support for accessing nested items in BoxList using numpy-style tuple indexing (thanks to Bit0r) * Adding tests and Cython releases for Python 3.12 * Fixing #251 support for circular references in lists (thanks to Muspi Merol) * Fixing #261 altering all `__repr__` methods so that subclassing will output the correct class name (thanks to Gabriel Tkacz) * Fixing #267 Fix type 'int' not iterable (thanks to YISH) --------- Co-authored-by: Bit0r <nie_wang@outlook.com> Co-authored-by: Muspi Merol <me@promplate.dev> Co-authored-by: Gabriel Tkacz <55806524+gtkacz@users.noreply.github.com> Co-authored-by: Gabriel Tkacz <gabriel.tkacz@gscap.com.br> Co-authored-by: YISH <mokeyish@hotmail.com>
Allow BoxList to use numpy-style tuple indexing, similar to
l[0,1,2,3]
, which is equivalent tol[0][1][2][3]
.