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

  • Home
  • SEARCH
  • 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 65k
  • Answers 66k
  • 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
  • added an answer There is no race possibility in you example (it' correctly… May 11, 2026 at 11:21 am
  • added an answer Option 1 : make sure that all different types of… May 11, 2026 at 11:21 am
  • added an answer I've been using recaptcha for a couple of sites with… May 11, 2026 at 11:21 am

Related Questions

I was looking at the builtin object methods in the Python documentation , and
I was looking at the API documentation for stl vector, and noticed there was
I was looking at the Ruby logging library Logging.logger method and have a question
I was looking at the Java code for LinkedList and noticed that it made
I was looking at the source code of java.uti.concurrent.locks.AbstractQueuedSynchronizer and the acquire() method looks
I was looking at the Proxy Pattern, and to me it seems an awful
I was looking at the System.Net Namespace and it has an IPAddress instance you
I was looking at the Linux From Scratch project awhile ago and was sort
I was really looking at the differences between pass by value and how Java
I was looking at Stack Overflow question What is the difference between abstract function

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.