Skip to content

_safe_indexing being the only *private* thing listed in classes.rst #27439

Open
Agent-Benchmarking/scikit-learn
#14

Description

@adrinjalali

_safe_indexing is the only private tool we have listed in classes.rst.

_safe_indexing was also mentioned in #15801, but this issue is to have the discussion about this very limited scope.

We should really either remove it from the docs, or make it public.

cc @glemaitre @thomasjpfan

Activity

  1. added
    Needs Triage
    on Sep 22, 2023
  2. glemaitre commented on Sep 22, 2023

    @glemaitre
    Member

    I would like to have public in the way that I want this function to be considered as a developer functions.

  3. removed
    Needs Triage
    on Sep 22, 2023
  4. thomasjpfan commented on Nov 25, 2023

    @thomasjpfan
    Member

    Historically, _safe_indexing was public and we made it private. Over the last few years, _safe_inexing behavior has changed slightly from version to version so it's not stable in that sense.

    Given how often we use _safe_indexing internally, a public _safe_indexing would be useful for third party libraries.

  5. adrinjalali commented on Dec 4, 2023

    @adrinjalali
    MemberAuthor

    how about having it as __safe_indexing__? With the right disclaimers about potential changes re:API.

  6. glemaitre commented on Dec 4, 2023

    @glemaitre
    Member

    Over the last few years, _safe_inexing behavior has changed slightly from version to version so it's not stable in that sense.

    I don't recall that we broke the backward compatibility. However, we added new features over the years.

  7. lorentzenchr commented on Nov 17, 2025

    @lorentzenchr
    Member

    +0 (can live either way)
    A few thoughts: Maybe the fact that we internally use it very often is an indication that should not make it public. Indexing does not seem to be something that scikit-learn should fix, IMO. On the other side, many projects seem to import it even if it's not public.
    The difficult part about it is the mix between Array API and Dataframes. The latter alone can be done with narwhals.

  8. lorentzenchr commented on Nov 17, 2025

    @lorentzenchr
    Member

    For the time being, I think we should remove it from the public API, #32728. We can add it again when we conclude to make it public again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    APINeeds Decision

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions