I’m not sure what the right thing to do is, but some differences between the @setattr
approach and the bare function approach:
- bare functions don’t accept
self
. Havingself
is useful in case you want your converter to access member variables or even class methods (which could be very useful). - bare functions specify all of the field attributes in one place rather than having extraneous methods laying around.
- the setattr approach allows the converter to be overridden in a derived class without re-specifying the entire field.
I think we want to have access to self if possible.