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

Repeated code #776

Open
DLJ7666 opened this issue Mar 2, 2024 · 2 comments
Open

Repeated code #776

DLJ7666 opened this issue Mar 2, 2024 · 2 comments
Labels
type: community enhancement feature request not on Twilio's roadmap

Comments

@DLJ7666
Copy link

DLJ7666 commented Mar 2, 2024

Issue Summary

There are some classes in the twilio/base folder which are basically a copy-paste between each other.
Couldn't just they be implemented in the way TwilioException is, as an abstract interface, which then each of these classes implementing such interface?
I think this would be a better code practice than the currently version is,

@tiwarishubham635
Copy link
Contributor

Hi @DLJ7666!
Will definitely take a look. Thanks!

@miniluz
Copy link

miniluz commented Mar 6, 2024

The classes I assume you are referring to (InstanceContext, InstanceResource, ListResource) are only identical because they are empty. They serve as abstract classes to be expanded upon. As a sample:

class ListResource(object):
    def __init__(self, version: Version):
        self._version = version

Since every class is only 3 lines long, two of them boilerplate, there really is no need to make an interface for them.

@tiwarishubham635 tiwarishubham635 added the type: community enhancement feature request not on Twilio's roadmap label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

No branches or pull requests

3 participants