Skip to content

Conversation

@invain01
Copy link
Contributor

Summary

Enforce Python 3.10+ best practices by adding strict=True to all zip() calls in key files. This ensures input iterables are of equal length, raising ValueError otherwise and preventing silent truncation.

Files Changed

  • asv_bench/benchmarks/ctors.py
  • asv_bench/benchmarks/series_methods.py
  • pandas/_testing/_warnings.py
  • pandas/_testing/asserters.py

Changes

  • All relevant zip() calls updated to zip(..., strict=True):
    • dict(zip(range(len(arr)), arr))dict(zip(range(len(arr)), arr, strict=True))
    • dict(zip(self.idx, range(len(self.idx))))dict(zip(self.idx, range(len(self.idx)), strict=True))
    • dict(zip(self.to_replace_list, self.values_list))dict(zip(self.to_replace_list, self.values_list, strict=True))
    • for warning_type, warning_match in zip(expected_warning, match):for warning_type, warning_match in zip(expected_warning, match, strict=True):
    • for left_arr, right_arr in zip(left, right):for left_arr, right_arr in zip(left, right, strict=True):
    • for elem1, elem2 in zip(iter1, iter2):for elem1, elem2 in zip(iter1, iter2, strict=True):

@mroeschke mroeschke added the Code Style Code style, linting, code_checks label Oct 22, 2025
@mroeschke mroeschke added this to the 3.0 milestone Oct 22, 2025
@mroeschke mroeschke merged commit dfe8b99 into pandas-dev:main Oct 22, 2025
45 of 46 checks passed
@mroeschke
Copy link
Member

Thanks @invain01

@invain01 invain01 deleted the new branch October 29, 2025 08:14
mittal-aakriti pushed a commit to mittal-aakriti/pandas that referenced this pull request Nov 19, 2025
mittal-aakriti pushed a commit to mittal-aakriti/pandas that referenced this pull request Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code Style Code style, linting, code_checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants