Open Dr-Blank opened 10 months ago
@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.
What is your feature request?
I suggest adding type hints throughout the codebase to enhance its clarity and maintainability. Type hints provide several benefits:
Readability: Type hints serve as documentation, making it easier for developers to understand the code and its intended usage.
Early Detection of Errors: Type hints enable static type checking tools to catch potential issues at compile-time, reducing the likelihood of runtime errors.
Tooling Support: Type hints improve IDE support, enabling better autocompletion, refactoring, and overall developer experience.
Improved Collaboration: With type hints, developers can more easily collaborate on the project, as the code becomes more self-explanatory.
Reduced Debugging Time: Type hints can help identify and resolve issues more quickly during the development process.
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.