Skip to content

Proposal: Remove Python 2 Support and Refactor Scripts to Modern Python 3 Syntax #69

@chen-qingyu

Description

@chen-qingyu

Dear maintainers,

I'd like to propose updating our Python scripts to use modern Python 3 syntax exclusively. Currently, maintaining compatibility with Python 2 requires extra complexity that may inadvertently hinder students' learning experience.

Key reasons for this change:

  1. Educational value:
    Students may analyze and modify these scripts as part of their learning journey. Legacy Python 2 syntax creates unnecessary cognitive load when they should be focusing on OS concepts.

  2. Readability matters:
    As the Zen of Python reminds us:

    • "Readability counts" (compatibility checks clutter core logic)
    • "There should be one obvious way to do it" (dual implementations violate this)
      Modern Python 3 features like f-strings (f"PID: {pid}") would make algorithms more transparent.
  3. Relevance:
    Python 2 reached end-of-life in 2020, and students now learn Python 3 first. Our scripts might better serve students through cleaner code.

Proposed approach:

  • Remove all Python 2 compatibility layers (e.g. __future__)
  • Migrate to Python 3.10+ LTS (or newer) with modern syntax
  • Maintain exact functionality through careful testing

If this proposal aligns with the project's educational goals, I'd be grateful for the opportunity to contribute initial refactoring for a few scripts as proof of concept.

Thank you kindly for your consideration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions