Skip to content

TYP: GH1474 Remove deprecated NumListLike and collapse arithmetic Sequence overloads#1686

Draft
cmp0xff wants to merge 1 commit intopandas-dev:mainfrom
cmp0xff:typ-refactor-mul-rmul-overloads
Draft

TYP: GH1474 Remove deprecated NumListLike and collapse arithmetic Sequence overloads#1686
cmp0xff wants to merge 1 commit intopandas-dev:mainfrom
cmp0xff:typ-refactor-mul-rmul-overloads

Conversation

@cmp0xff
Copy link
Copy Markdown
Contributor

@cmp0xff cmp0xff commented Feb 26, 2026

Summary

Closes #1474. Propagates the fix for pandas-dev/pandas#62353.

Remove NumListLike (resolves #1474)

NumListLike was introduced in #1360 and contained a suspicious dict[str, np.ndarray] member. It was never correct for arithmetic operations and was marked for deprecation. This PR removes it entirely from base.pyi and inlines its components directly into each arithmetic method's other parameter:

  • __mul__ / __rmul__ / mul / rmul on Series[Never]
  • __sub__ / sub on Series[Never]
  • __sub__ / sub on Series[Timestamp]

Collapse __add__ / __radd__ Sequence workaround (pandas-dev/pandas#62353)

The old workaround introduced two separate overloads to handle the case where other is a sequence — one restricted to non-datetime scalar types via S2_NDT_contra — because pandas used to raise a TypeError for datetime array arithmetic with lists. Now that the upstream issue is fixed:

  • Merge the two overloads into one: other: SupportsRAdd[S2_contra, S2] | Sequence[SupportsRAdd[S2_contra, S2]]
  • Remove the S2_NDT_contra import from series.pyi
  • Add Sequence[datetime] to Series[Timestamp].__sub__ so list-of-datetime subtraction is covered

🤖 Co-authored by Claude Sonnet 4.6

@cmp0xff cmp0xff marked this pull request as draft February 26, 2026 06:57
@cmp0xff cmp0xff force-pushed the typ-refactor-mul-rmul-overloads branch from 96267bb to 78bc416 Compare February 26, 2026 22:47
@cmp0xff cmp0xff changed the title TYP: Refactor __mul__/__rmul__/mul/rmul overloads to use type aliases TYP: GH1474 Remove deprecated NumListLike and collapse arithmetic Sequence overloads Feb 26, 2026
@cmp0xff cmp0xff force-pushed the typ-refactor-mul-rmul-overloads branch from 78bc416 to 0675969 Compare February 26, 2026 22:51
@cmp0xff cmp0xff force-pushed the typ-refactor-mul-rmul-overloads branch from 0675969 to 5aa84b0 Compare February 27, 2026 14:33
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

Successfully merging this pull request may close these issues.

Deprecate NumListLike

1 participant