-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Many objects have attributes that are not preceded by underscores, therefore by convention, they are considered to be public. It would be better practice to make all attributes private, and provide getters and setter methods for users to explicitly read and change attributes. Here is a general example of how to revise:
Before: attributes set on the object without getters/setters:
class Solution
def __init__(dss_file, **kwargs):
self.V = NoneAfter: prepend all attributes with underscores and provide getters and setters as appropriate:
class Solution
def __init__(dss_file, **kwargs):
self._V = None
def get_V(self):
return self._V
def set_V(self):
raise Error("Cannot set Solution voltages.")Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers