Skip to content
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

a minor issue of index of list. #194

Open
17183248569 opened this issue Aug 23, 2023 · 0 comments
Open

a minor issue of index of list. #194

17183248569 opened this issue Aug 23, 2023 · 0 comments

Comments

@17183248569
Copy link

17183248569 commented Aug 23, 2023

if isinstance(index, (int, slice)):

there is a corner case that need to be note.
the object used as an index of a list, can be something other than int or slice.

it may be any object with an __index__ method which returns an int. for example, uint8 from numpy is not a subclass of pythons built in int. therefore, it cant be used as index of ListTag. (but it can be used as index of IntArrayTag)

i suggest to add a attribute in Path object: "isNbtPath". then we can use hasattr(index, "isNbtPath") to know if it is a nbt_Path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant