ufoLib2
ufoLib2 copied to clipboard
use on_setattr to auto-convert dict to Lib and Kerning
One can use on_setattr=attrs.setters.convert on a field that has an attrs converter defined (e.g. Font.lib or Glyph.lib) to run the field converter whenever the attribute is set, not just at default constructor time.
It's a nice feature, allows to remove the property getter/setter boilerplate, and it's actually a bit faster to get/set the field compared to the properties.
But mypy doesn't like it.. https://github.com/python-attrs/attrs/issues/889