laike9m / pdir2

Pretty dir() printing with joy:beer:
MIT License
1.33k stars 47 forks source link

ANSI escape chars shown when using rich.inspect(PrettyDir) #66

Closed tddschn closed 2 years ago

tddschn commented 2 years ago

The behavior was encountered when using rich.inspect on a PrettyDir object, although unexpected, might not be a bug.

To reproduce the error, run

python3 -c 'from rich import inspect; import pdir; inspect(pdir(print))'

Screenshot of output:

CleanShot-2022-05-29T21-12-46@2x

Other info

laike9m commented 2 years ago

pdir's output is supposed to be viewed by human, so I'd say this is expected behavior. Still, could you elaborate a bit why you want to call rich.inspect on a PrettyDir object?

tddschn commented 2 years ago

Sometimes I inspect an object with rich.inspect to see the property / attributes (with docstrings) and methods (including signatures and docstrings), since it's faster than finding and reading the docs to get what I want. :)

laixintao commented 2 years ago

might be resolved by #67