Skip to content

Commit edec06b

Browse files
committed
Add hyper-link for Item 55: Use repr strings for debugging output
1 parent d125c71 commit edec06b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,18 @@ Python 3.
547547
host introspection through the sys and os modules.
548548

549549

550-
### []()
550+
### [Item 55: Use repr strings for debugging output](item_55_use_repr_strings.py)
551+
- 1. Calling print on built-in Python types will produce the human-readable
552+
string version of a value, which hides type information.
553+
- 2. Calling repr on built-in Python types will produce the printable string
554+
version of a value. These repr strings could be passed to the eval
555+
built-in function to get back the original value.
556+
- 3. %s in format strings will produce human-readable strings like str.%r will
557+
produce printable strings like repr.
558+
- 4. You can define the __repr__ method to customize the printable
559+
representation of a class and provide more detailed debugging
560+
information.
561+
- 5. You can reach into any object's __dict__ attribute to view its internals.
551562

552563

553564
### []()

0 commit comments

Comments
 (0)