On 01.03.17 16:35, Paul Moore wrote:
On 1 March 2017 at 13:50, Steven D'Aprano <st...@pearwood.info> wrote:
It is possible that we could come up with a pretty-printing protocol,
but that wouldn't be a trivial job.

I'd be inclined to do this via simplegeneric. Let pprint do what it
currently does, but allow users to register implementations for
specific classes as they wish.

That is how pprint is implemented now. It register implementations for specific classes and dispatch them by type (or rather by __repr__ implementation). But these functions have too complex and non-extensible signatures and that is why this is an implementation detail.

There is an open issue for a pretty-printing protocol, but it is far from any progress.

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to