Get free YouTube views, likes and subscribers
Get Free YouTube Subscribers, Views and Likes

Python's __repr__ and __str__

Follow
Python Morsels

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

Read an article version of this video at https://pym.dev/customizingstringre...

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

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

#python #oop

posted by triarlyviaddyr6