Skip to content

Commit 5869775

Browse files
Евгений БлиновЕвгений Блинов
authored andcommitted
Customize sys.displayhook behavior with declarative transformers
1 parent 7b4c8a0 commit 5869775

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
![logo](https://raw.githubusercontent.com/mutating/displayhooks/develop/docs/assets/logo_1.svg)
1919

2020

21-
It's a micro library for manipulating [`sys.displayhook`](https://docs.python.org/3/library/sys.html#sys.displayhook).
21+
It's a micro-library for customizing [`sys.displayhook`](https://docs.python.org/3/library/sys.html#sys.displayhook).
2222

23-
When you need to change the standard behavior of `displayhook`, with this library you will do it:
23+
If you need to change the default behavior of `sys.displayhook`, this library lets you do it:
2424

2525
- 💎 declaratively
2626
- 🫥 compactly
@@ -30,7 +30,7 @@ When you need to change the standard behavior of `displayhook`, with this librar
3030
## Table of contents
3131

3232
- [**Quick start**](#quick-start)
33-
- [**Change the displayed value**](#change-the-displayed-value)
33+
- [**Transform displayed values**](#transform-displayed-values)
3434
- [**Prohibiting the display of certain types of values**](#prohibiting-the-display-of-certain-types-of-values)
3535
- [**Automatic recovery of the default hook**](#automatic-recovery-of-the-default-hook)
3636

@@ -43,7 +43,7 @@ Install it:
4343
pip install displayhooks
4444
```
4545

46-
And use:
46+
Then use it:
4747

4848
```python
4949
import sys
@@ -57,9 +57,9 @@ sys.displayhook(666)
5757
# [nothing!]
5858
```
5959

60-
## Change the displayed value
60+
## Transform displayed values
6161

62-
You can declaratively declare a converter function for the printed values. What it returns will be used to call the original `displayhook` function.
62+
You can declaratively define a converter function for displayed values. Its return value will be passed to the original `displayhook` function.
6363

6464
```python
6565
import sys
@@ -73,8 +73,7 @@ sys.displayhook("What’s gone with that boy, I wonder? You TOM!")
7373
#> 'what’s gone with that boy, i wonder? you tom!'
7474
```
7575

76-
If your function returns `None`, nothing will be printed.
77-
76+
If your function returns `None`, nothing is displayed.
7877

7978
## Prohibiting the display of certain types of values
8079

0 commit comments

Comments
 (0)