Skip to content

How do I pretty print the source code of functions contained in a class instance's attributes? #3428

Answered by willmcgugan
bzm3r asked this question in Q&A
Discussion options

You must be logged in to vote

It's not a rich repr you need. Repr strings should be simple text. You can build a renderable that yields a Syntax object or any other builtin renderable.

Have a read though the following page in the docs:

https://rich.readthedocs.io/en/latest/protocol.html

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by bzm3r
Comment options

You must be logged in to vote
1 reply
@willmcgugan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants