datatyping
datatyping copied to clipboard
Implement datatyping.printer with subclassing
I was super stupid, when I implemented datatyping.printer.py. It should be implemented with subclassing instead of monkey patching (with context managers). This would also make it thread-safe.
Relevant: #2.
Hey! I just started to do some work on this.
One thing I noticed is that _test_printer.py is hidden from the test suite. Does that have an existing test failure that I should try to fix?
This PR has the change: https://github.com/carlbordum/datatyping/pull/9
This is super nice!
Does it make sense for datatyping.printer._new_safe_repr to be in the subclass aswell?
I think I disabled the test, because it makes a http request. Maybe once #4 is done, we can have tests for this.
I don't think _new_safe_repr should be in the subclass - I've tried to put the minimum number of overrides in there, and the current way mirrors how pprint._safe_repr works.
Awesome work!
/merged/