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.

3
  • 1
    Did you check this answer? Commented Mar 18, 2014 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. Commented Mar 18, 2014 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. Commented Mar 18, 2014 at 15:11

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.