You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unlike some other OO languages (e.g., Java), a common practice in Python is to avoid adding getters and setters for each class attribute. Instead, the more Pythonic thing to do is allow users of the class to access the attributes directly. Then, if a getter/setter is truly necessary (e.g., some code must be executed before returning a class attribute), Python properties can be used instead (similar to C# properties).
As many of the classes in fresco are simple data containers, I think most of the class attributes should have their getters and setters removed, and replaced with properties where necessary. This will cut down on the verbosity/size of the code, make it easier to read, and still flexible enough to easily add getters/setters in the future if/when they become necessary.
See this SO post for more details, and the classes in this QIIME module for some examples of where this is being used.
The text was updated successfully, but these errors were encountered:
Unlike some other OO languages (e.g., Java), a common practice in Python is to avoid adding getters and setters for each class attribute. Instead, the more Pythonic thing to do is allow users of the class to access the attributes directly. Then, if a getter/setter is truly necessary (e.g., some code must be executed before returning a class attribute), Python properties can be used instead (similar to C# properties).
As many of the classes in fresco are simple data containers, I think most of the class attributes should have their getters and setters removed, and replaced with properties where necessary. This will cut down on the verbosity/size of the code, make it easier to read, and still flexible enough to easily add getters/setters in the future if/when they become necessary.
See this SO post for more details, and the classes in this QIIME module for some examples of where this is being used.
The text was updated successfully, but these errors were encountered: