panyanyany/beeprint

Option to use a class' __repr__ when implemented

Closed this issue · 4 comments

Perhaps there is a way to detect if some object implemented its own repr. In such a case, it should be possible for these objects to be displayed by how it was intended. If no repr, your package provides a very great way of showing what a class represents.

now it supports user-defined repr of class instance.
please try newest version of 2.4.2.

2.4.2 appears broken, cannot import:


>>> from beeprint import pp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/beeprint/__init__.py", line 1, in <module>
    from .printer import pp
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/beeprint/printer.py", line 25, in <module>
    from .models.block import Block, Context
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/beeprint/models/block.py", line 14, in <module>
    from beeprint.debug_kit import debug
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/beeprint/debug_kit.py", line 11, in <module>
    from pprintpp import pprint as pp
ImportError: No module named 'pprintpp'

OSX, Python 3.5.0

sorry about that.

sometimes i want to test some other libraries. so i import it and just want to know how it prints.

now i release a new version of 2.4.4. please try.

Fixed. But: instance(A): is printed in front of the __repr__. I would expect nothing from beeprint, just the original repr, no instance(A): in front.