-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pformat on pyrsistent objects #70
Comments
I agree, would be nice! I'll look into it. |
This seems difficult: in Python 2.7 and 3.4 |
Yes, I read that SO post as well when looking at this issue the first time. If it is implemented through monkey patching (I have not found any good alternatives) that would probably be done through an explicit call to some function (eg. pyrsistent.enable_pprint()). I wouldn't want to mess with the stdlib functionality without making it very explicit. |
Python 3.5 appears to have a more extensible implementation of pprint (https://github.com/python/cpython/blob/master/Lib/pprint.py). I don't know if it works out of the box w/ pyrsistent (I guess it ought to if pyrsistent uses the collections abstract base classes?). I think a good way to start would be to avoid the question of monkey-patching altogether by providing alternative functions that pretty-format and pretty-print regular Python objects and pyrsistent objects. If it turns out that they are useful, then monkey-patching can be implemented separately. |
It'd be great if
pprint
andpformat
worked "properly" on pyrsistent objects. That is, if the output ofpformat(some_pmap)
were comparable topformat(some_dict)
.That is, the following Python code...
... produces this output ...
Whereas it should produce:
... or something similar
(Related to #69, but this is a request for enhancement, rather than a defect report. Fixing this would probably also fix #69)
The text was updated successfully, but these errors were encountered: