Skip to content

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

Closed as not planned
Closed as not planned
@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

    Python APIIssue is about the Python APIenhancementNew feature or requestfutureIssues that are closed as they are not planned in the medium-term, but which are still desirable.good first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions