ufoLib2 icon indicating copy to clipboard operation
ufoLib2 copied to clipboard

use on_setattr to auto-convert dict to Lib and Kerning

Open anthrotype opened this issue 4 years ago • 0 comments

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

anthrotype avatar Dec 16 '21 17:12 anthrotype