Skip to content

Remove left-over Python 2-isms#1283

Draft
mhucka wants to merge 5 commits intoquantumlib:mainfrom
mhucka:remove-python2-left-overs
Draft

Remove left-over Python 2-isms#1283
mhucka wants to merge 5 commits intoquantumlib:mainfrom
mhucka:remove-python2-left-overs

Conversation

@mhucka
Copy link
Copy Markdown
Contributor

@mhucka mhucka commented Apr 23, 2026

This removes Python 2 compatibility shims and constructs that were not addressed in a previous PR to remove Python 2 shims.

  • Removed from builtins import map, zip in src/openfermion/utils/operator_utils.py. These were legacy imports from the future library to provide Python 3 behavior in Python 2.

  • Removed explicit (object) inheritance from all class definitions.

  • Removed the redundant u prefix from string literals, because in Python 3, all strings are Unicode by default.

@mhucka mhucka added area/health Involves code and/or project health python Pull requests that update python code labels Apr 23, 2026
@mhucka
Copy link
Copy Markdown
Contributor Author

mhucka commented Apr 23, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modernizes the codebase by removing legacy Python 2 compatibility artifacts. Key changes include transitioning to Python 3 class definitions by removing explicit inheritance from 'object', updating 'super()' calls to the simplified Python 3 syntax, and removing 'u' prefixes from string literals. Additionally, the pylint configuration and imports have been cleaned up to remove references to compatibility libraries like 'six' and 'future'. I have no feedback to provide.

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

Labels

area/health Involves code and/or project health python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant