Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Fix some antipatterns #654

Closed
wants to merge 2 commits into from
Closed

Fix some antipatterns #654

wants to merge 2 commits into from

Conversation

arnu515
Copy link

@arnu515 arnu515 commented Oct 5, 2022

Description

Fixed some anti-patterns and best practices related to python.

Here's what I did:
Replace for if statements with any():
The any function is a builtin python function that returns True if atleast one item in a list is True, and False otherwise. It makes the code more readable and is faster than using for-if condition

Use in [...] instead of multiple ==:
In Python, it is recommended to use variable in [a, b, c, d] instead of saying variable == a or variable == b ... since it will be much faster, and more readable.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation Update

Checklist:

Please tick all the boxes that are fulfilled by your Pull Request.

  • I have named my files and folder, according to this project's guidelines.
  • My code follows the style guidelines of this project.
  • My Pull Request has a descriptive title. (not a vague title like Update index.md)
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have created a helpful and easy to understand README.md, according to the given README_TEMPLATE.
  • I have included a requirements.txt file (if external libraries are required.)
  • My changes do not produce any warnings.
  • I have added a working sample/screenshot of the script.

@AdityaJ7 AdityaJ7 closed this Oct 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants