Suppose I am recording data and want to link a number of data elements, so that each recorded set always has a fixed composition, that is, missing fields.
Most of my programming experience is with Ada or C / C ++ variants. In Ada, I would use the record type and aggregate assignment, so when the record type has been updated with new fields, anyone who uses this record will be notified by the compiler. In C ++, most likely I would use a storage class and constructor to do something like this.
What is the appropriate way to handle this situation in Python? Is this the case when classes are the correct answer, or is there a lighter weight analogue of Ada's notation?
An additional thought, both Ada records and C ++ constructors allow default initialization values. Is there a Python solution for the above question that also provides this feature?
source
share