Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Type Hints to Improve Codebase Readability and Maintainability #1296

Open
Dr-Blank opened this issue Nov 11, 2023 · 1 comment
Open

Add Type Hints to Improve Codebase Readability and Maintainability #1296

Dr-Blank opened this issue Nov 11, 2023 · 1 comment

Comments

@Dr-Blank
Copy link
Contributor

What is your feature request?

I suggest adding type hints throughout the codebase to enhance its clarity and maintainability. Type hints provide several benefits:

  1. Readability: Type hints serve as documentation, making it easier for developers to understand the code and its intended usage.

  2. Early Detection of Errors: Type hints enable static type checking tools to catch potential issues at compile-time, reducing the likelihood of runtime errors.

  3. Tooling Support: Type hints improve IDE support, enabling better autocompletion, refactoring, and overall developer experience.

  4. Improved Collaboration: With type hints, developers can more easily collaborate on the project, as the code becomes more self-explanatory.

  5. Reduced Debugging Time: Type hints can help identify and resolve issues more quickly during the development process.

  6. Enhanced Code Quality: The addition of type hints promotes better coding practices and can lead to a more robust and maintainable codebase.

Are there any workarounds?

No response

Code Snippets

No response

Additional Context

If this proposal resonates with the community, I am willing to contribute to the implementation of type hints. I believe this enhancement will significantly benefit both current and future contributors.

Thank you for considering this improvement.

@Dr-Blank
Copy link
Contributor Author

Dr-Blank commented Jan 16, 2024

@JonnyWong16

can attr key be None in any case? if so, for which cases and is key=None useful? as I believe all media items must have a key, hence key can not be None for all of those cases. correct me if I am wrong, but if that is the case, a base class for those items should make it key compulsory and for objects that have key as None should not inherit from this class with attr key in it.

I am saying this as it will save a ton of if self.key is None checks in methods which actually use key.

other option is to make it default to an empty string instead of None but that is risky.

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

No branches or pull requests

1 participant