0

I've read the documentation on repr() but I have a feeling that it may be more useful than the docs are giving it credit for. If my speculative feeling is correct, is someone able to provide instances with which repr() comes into its own.

cmd
  • 5,754
  • 16
  • 30
Phoenix
  • 4,386
  • 10
  • 40
  • 55
  • 1
    Did you check [this answer](http://stackoverflow.com/a/7784214/1595865)? – loopbackbee Mar 18 '14 at 14:43
  • Yeh I read this page, at my current level of understanding I can't seem to recognise a use for repr(), is there an example that can be supplied which may flick the switch on. – Phoenix Mar 18 '14 at 14:59
  • 1
    The main use for `repr()` for me is to show debug output of complex data structures. While `str()` should give a representation which is less technical (e. g. `Martin Shultz, developer`), the `repr()` should give a version which can be read as Python source and ideally will create that object anew (e. g. `Person('Martin', 'Shultz', 'developer')`), although this often is not possible for complex objects, of course. – Alfe Mar 18 '14 at 15:11

0 Answers0