Author marcelpvisser
Recipients marcelpvisser
Date 2020-01-27.11:09:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
After instantiation of a variable of a DataClass, it is possible to assign new attributes (that were not defined in defining the DataClass):

data.new_attribute = 3.0  # does NOT raise Error!

This gives unexpected behaviour: if you print the variable, then 'new_attribute' is not printed (since it is not in the definition of the DataClass).

Assigning to an attribute is therefore not typo-safe (which users may expect from a DataClass).

I would expect the behaviour of the DataClass be consistent and typo-safe.

Attached is a file that demonstrates the bug (behaviour) and provides a 'SafeDataClass' by overriding the __setattr__ method.

My suggestion would be to the adjust the library __setattr__ for the DataClass such that is will be typo-safe.
Date User Action Args
2020-01-27 11:09:27marcelpvissersetrecipients: + marcelpvisser
2020-01-27 11:09:27marcelpvissersetmessageid: <>
2020-01-27 11:09:27marcelpvisserlinkissue39462 messages
2020-01-27 11:09:27marcelpvissercreate