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 6325977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:59:44+00:00 2026-05-24T16:59:44+00:00

In the interpreter you can just write the name of an object e.g. a

  • 0

In the interpreter you can just write the name of an object e.g. a list a = [1, 2, 3, u"hellö"] at the interpreter prompt like this:

>>> a
[1, 2, 3, u'hell\xf6']

or you can do:

>>> print a
[1, 2, 3, u'hell\xf6']

which seems equivalent for lists. At the moment I am working with hdf5 to manage some data and I realized that there is a difference between the two methods mentioned above. Given:

with tables.openFile("tutorial.h5", mode = "w", title = "Some Title") as h5file:
    group = h5file.createGroup("/", 'node', 'Node information')
    tables.table = h5file.createTable(group, 'readout', Node, "Readout example")

The output of

print h5file

differs from

>>> h5file

So I was wondering if someone could explain Python’s behavioral differences in these two cases?

  • 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. Editorial Team
    Editorial Team
    2026-05-24T16:59:45+00:00Added an answer on May 24, 2026 at 4:59 pm

    Typing an object into the terminal calls __repr__(), which is for a detailed representation of the object you are printing (unambiguous). When you tell something to ‘print’, you are calling __str__() and therefore asking for something human readable.

    Alex Martelli gave a great explanation here. Other responses in the thread might also illuminate the difference.

    For example, take a look at datetime objects.

    >>> import datetime
    >>> now = datetime.datetime.now()
    

    Compare…

    >>> now
    Out: datetime.datetime(2011, 8, 18, 15, 10, 29, 827606)
    

    to…

    >>> print now
    Out: 2011-08-18 15:10:29.827606
    

    Hopefully that makes it a little more clear!

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

Sidebar

Related Questions

In sum: I need to write a List Comprehension in which i refer to
Python language has a well known feature named interactive mode where the interpreter can
Can I run the python interpreter without generating the compiled .pyc files?
if we implement java interpreter in hardware then how we can achieve architecture neutrality
I'm trying to find a markdown interpreter class/module that I can use in a
Python has a flag -O that you can execute the interpreter with. The option
I am trying to understand how a language interpreter works. Can you guys point
Is there online Powershell interpreter available on the Internet? I mean like trypython for
You can write UTF-8/16/32 string literals in C++11 by prefixing the string literal with
The Python interpreter can be started with -tt to raise a TabError exception if

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.