Skip to content

a minor issue of index of list. #194

@ch-yx

Description

@ch-yx

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions