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
TL; DR: Python is not strict to types, should we check additionally the types of values assigned to classes' fields, in particularly DomainModel?
I was (still) exploring the features of BUML, and while creating a new DomainModel class, I completed wrong the associations parameter fro constructor: I put there set of ends, but not the set of Association type. Something stupid like this:
However, code ran well, I still could properly reach list of associations per class, get their ends etc. It was until the moment I called model_cinema.associations property and tried to call list of ends, like this:
for association in model.associations:
if len(association.ends) == 2:
...
And here the code crashed (AttributeError: 'Property' object has no attribute 'ends'), as set of Association was actually a set of Property due to my wrong DomainModel object definition.
For sure, that was caused by wrong declaration of new object, but it seemed to me, that the program should be halted at the moment of wrong definition, not in the runtime after.
The text was updated successfully, but these errors were encountered:
TL; DR: Python is not strict to types, should we check additionally the types of values assigned to classes' fields, in particularly DomainModel?
I was (still) exploring the features of BUML, and while creating a new DomainModel class, I completed wrong the
associations
parameter fro constructor: I put there set ofends
, but not the set ofAssociation
type. Something stupid like this:However, code ran well, I still could properly reach list of associations per class, get their ends etc. It was until the moment I called
model_cinema.associations
property and tried to call list ofends
, like this:And here the code crashed (
AttributeError: 'Property' object has no attribute 'ends'
), as set ofAssociation
was actually a set ofProperty
due to my wrongDomainModel
object definition.For sure, that was caused by wrong declaration of new object, but it seemed to me, that the program should be halted at the moment of wrong definition, not in the runtime after.
The text was updated successfully, but these errors were encountered: