I was attempting to assist on an open-source project when I was stopped short by this (names have been changed):class DataPoint: measurement1 = None measurement2 = None measurement3 = None DataPoint was later used like this:d = DataPoint() d.measurement1 = 100 d.measurement2 = 200 d.measurement3 = 300 Why give names and initialization values to class attributes, then when you make an object, immediately create and initialize instance variables with the same names as the class attributes?
Published on May 10, 2022 17:00