Skip to content

Error if boolean passed as row index or slice? #2705

Open
@benjeffery

Description

@benjeffery

I was recently helping a new user who has R experience who tried tables.nodes['individual'==0] which gave the first node as it is equal to tables.nodes[False] which gets interpreted as tables.nodes[0]. (This is because isinstance(False, numbers.Integral) is True which was a surprise to me)

I think it should be a ValueError to __getitem__ with a bool? Or do what numpy does and return [].

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions