twilio-python icon indicating copy to clipboard operation
twilio-python copied to clipboard

Repeated code

Open DLJ7666 opened this issue 1 year ago • 2 comments

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,

DLJ7666 avatar Mar 02 '24 14:03 DLJ7666

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

tiwarishubham635 avatar Mar 06 '24 08:03 tiwarishubham635

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.

miniluz avatar Mar 06 '24 16:03 miniluz