0
What is the use of the dunder __repr__ in the str(string) class ?
Kindly explain how __repr__ works exactly !
2 Antworten
+ 2
__repr__ is used by repr global function: it is used to return the representation of the object/value (an alternate way from the str way):
https://www.geeksforgeeks.org/str-vs-repr-in-JUMP_LINK__&&__python__&&__JUMP_LINK
0
ch Murali ,
python.org has the definitive information on every Python language feature, but its self-search is usually useless and returns 0 results for __repr__.
Instead, use a site search from an external search engine. I just pasted the following into DuckDuckGo and got a bunch of links directly to specific pages on python.org.
site:python.org __repr__
Another option, and the one I use most often is to go to the general index page on python.org and alphabetically drill down to the thing you're after. Everything's there, including __repr__.
https://docs.python.org/3/genindex.html