Skip to content

Conversation

@tusharnankani
Copy link

This PR includes:

  • Remove unused imported modules [Anti-pattern]

  • Remove unnecessary else / elif used after return or raise

    • return statement causes the control flow to be disrupted, making the else / elif block here unnecessary. This doesn't mean you can not use it, but it is recommended to refactor this for better readability.
  • Remove unnecessary use of comprehension.

    • It is unnecessary to use a comprehension just to loop over the iterable and create a list/set/dict out of it. Python has a specialized set of tools for this task: the list/set/dict constructors, which are faster and more readable.
  • Changing the default arguments.

    • It is recommended not to use a mutable like list or dictionary as a default value to an argument. Python’s default arguments are evaluated once when the function is defined. Using a mutable default argument and mutating it will mutate that object for all future calls to the function as well.

@tusharnankani
Copy link
Author

@RameenAbdal Any updates?

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.

1 participant