Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 119859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:43:10+00:00 2026-05-11T03:43:10+00:00

I was looking at the builtin object methods in the Python documentation , and

  • 0

I was looking at the builtin object methods in the Python documentation, and I was interested in the documentation for object.__repr__(self). Here’s what it says:

Called by the repr() built-in function and by string conversions (reverse quotes) to compute the “official” string representation of an object. If at all possible, this should look like a valid Python expression that could be used to recreate an object with the same value (given an appropriate environment). If this is not possible, a string of the form <…some useful description…> should be returned. The return value must be a string object. If a class defines repr() but not str(), then repr() is also used when an “informal” string representation of instances of that class is required.

This is typically used for debugging, so it is important that the representation is information-rich and unambiguous

The most interesting part to me, was…

If at all possible, this should look like a valid Python expression that could be used to recreate an object with the same value

… but I’m not sure exactly what this means. It says it should look like an expression which can be used to recreate the object, but does that mean it should just be an example of the sort of expression you could use, or should it be an actual expression, that can be executed (eval etc..) to recreate the object? Or… should it be just a rehasing of the actual expression which was used, for pure information purposes?

In general I’m a bit confused as to exactly what I should be putting here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:43:11+00:00Added an answer on May 11, 2026 at 3:43 am
    >>> from datetime import date >>> >>> repr(date.today())        # calls date.today().__repr__() 'datetime.date(2009, 1, 16)' >>> eval(_)                   # _ is the output of the last command datetime.date(2009, 1, 16) 

    The output is a string that can be parsed by the python interpreter and results in an equal object.

    If that’s not possible, it should return a string in the form of <...some useful description...>.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 95k
  • Answers 95k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer See this previous SO question, which covers bash. Tcsh provides… May 11, 2026 at 7:02 pm
  • Editorial Team
    Editorial Team added an answer The correct signature for the save method should be: public… May 11, 2026 at 7:02 pm
  • Editorial Team
    Editorial Team added an answer Are you sure sem_wait() causes signals to be blocked? I… May 11, 2026 at 7:02 pm

Related Questions

Is it possible to explicitly set the id of a domain object in Grails'
I have an array of float values and want the value and more importantly
.Net's Server.HTMLEncode() is the very helpful function that takes an HTML string and replaces
I'm seeing something very very strange happening in a Flex app I'm maintaining. I've

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.