Re:Using attrs for everything in Python
by BerislavLopac on Friday August 26, 2016 @01:03AM
(#12364323)
attrs seems to be all over the place, but I find Schematics (http://schematics.readthedocs.io/en/latest/) much better designed and more powerful.
[ Parent
| on HN ]
Re:Using attrs for everything in Python
by asciihacker on Friday August 26, 2016 @09:34AM
(#12366082)
Yes, Schematics is impressive. Thank you, I added it to my list of Python OOP extensions [1]. I wonder why you need to supply a dictionary to the object instead of keyword pairs.
Re:Using attrs for everything in Python
by BerislavLopac on Sunday August 28, 2016 @11:12AM
(#12376813)
> I wonder why you need to supply a dictionary to the object instead of keyword pairs.
My understanding is that the main reason is to make constructors more flexible, with arguments like _raw_data_, _trusted_data_ etc. But it is trivial to write a simple helper function that would accept keyword pairs and build a model instance.