Add support for accessing nested items in BoxList using numpy-style tuple indexing.#266
Add support for accessing nested items in BoxList using numpy-style tuple indexing.#266cdgriffith merged 2 commits intocdgriffith:developfrom Bit0r:master
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] == 4But 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].