What is the difference between __str__ and __repr__? — def __str__(self): - meant to be human readable def __repr__(self): - mean to represent the object and be unambiguous, usually as the constructor: for a Vector class, would be: def __repr__(self): return "Vector({!r}, {!r})".format(self.x, self.y) OR return "Vector(%r, %r)" % (self.x, self.y) Containers use __repr__ of elements when __str__ is called on container.

G
picture loading error handler
1227 thought(s)1.2K

Google Interview

This flashcard deck made by jwasham contains knowledge about google interview. For more details, please follow https://github.com/jwasham/google-interview-university
interview
computer science
development

Explore more quotes

ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha
ahmed kamel taha