added angular example

This commit is contained in:
Will McGugan 2021-06-10 09:29:50 +01:00
parent f7c3c98e66
commit a9d723dd69
1 changed files with 9 additions and 0 deletions

View File

@ -157,4 +157,13 @@ You can also tell Rich to generate the *angular bracket* style of repr, which te
__rich_repr__.angular = True
This will change the output of the Rich repr example to the following::
{
'gull': <Bird 'gull' eats=['fish', 'chips', 'ice cream', 'sausage rolls']>,
'penguin': <Bird 'penguin' eats=['fish'] fly=False>,
'dodo': <Bird 'dodo' eats=['fruit'] fly=False extinct=True>
}
Note that you can add ``__rich_repr__`` methods to third-party libraries *without* including Rich as a dependency. If Rich is not installed, then nothing will break. Hopefully more third-party libraries will adopt Rich repr methods in the future.