Python's __repr__ and __str__

Описание к видео Python's __repr__ and __str__

You'll almost always just want to customize one of Python's two string representations (repr, the programmer readable-one). The human-readable representation (str) delegates to repr by default.

Read an article version of this video at https://pym.dev/customizing-string-re...

Find more Python screencasts at https://pym.dev/screencasts/

00:00 The default string representation
00:28 Explicit string conversions use _str_
01:13 Programmer-readable string conversions use _repr_
02:17 You really only need _repr_
03:03 Recap

#python #oop

Комментарии

Информация по комментариям в разработке