complex types should be constructed with arguments
Bug #1220906 reported by
Doug Hellmann
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
WSME |
New
|
Undecided
|
Unassigned |
Bug Description
Complex and user-defined types are constructed by calling __init__() without any arguments and then calling setattr() to set the attributes. This doesn't let the instance do any validation across attributes, to check for things like mutually exclusive settings or combinations of values that do not make sense.
https:/
To post a comment you must log in.
I am not so sure using the default constructor is the right way to go.
We may want to keep different behavior when a complex type is received and when we init it for sending.
Moreover, for now at least, we cannot assume the constructor has parameters for each exposed attribute, nor that they have the same names.
May be a specialized factory function would be better, that could be overloaded for additionnal checking.