Skip to content

Do not use reserved Python keywords as variable names #4152

Open

Description

@soupault

Description

This requires searching throught the complete codebase and renaming/deprecating old function/variable names.

The most commonly misused are filter and slice.

Activity

  1. added
    🔧 type: Maintenance
    on Sep 11, 2019
  2. added this to the 1.0 milestone on Sep 11, 2019
  3. rfezzani commented on Sep 12, 2019

    @rfezzani
    Member

    Using

    grep -wr --include \*.py key_word skimage/
    

    I found:

    • filter in skimage/transform/radon_transform.py
    • slice used in skimage/measure/_regionprops.py
    • min and max in skimage/restoration/_denoise.py
    • input in skimage/measure/_label.py

    I wrote some times ago a decorator for handling the deprecation of function's argument name without backward compatibility break.
    Such mechanism can be used to clean the codebase without any hurt for the user.

  4. rfezzani commented on Sep 13, 2019

    @rfezzani
    Member

    I wrote the PR #4158 to demonstrate how this issue can be managed using a decorator. Let me know if this kind of solution is acceptable or not ;-)

  5. rfezzani commented on Sep 25, 2019

    @rfezzani
    Member

    I also found next used in skimage/morphology/greyreconstruct.py 😄

  6. rfezzani commented on Jan 22, 2020

    @rfezzani
    Member

    Do we consider that array is an acceptable argument name? I found an occurrence in graph.mcp.route_through_array for example.

  7. jni commented on Jan 23, 2020

    @jni
    Member

    I would say yes, array is not reserved.

  8. soupault commented on Jan 23, 2020

    @soupault
    MemberAuthor
  9. locked and limited conversation to collaborators on Oct 18, 2021
  10. added
    📜 type: API
    on Mar 21, 2022
  11. unlocked this conversation on Mar 21, 2022
  12. modified the milestones: 0.21, 0.22 on May 19, 2023
  13. removed this from the 0.22 milestone on Oct 3, 2023
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

    📜 type: API🔧 type: Maintenance

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions