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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:02:48+00:00 2026-05-15T13:02:48+00:00

The following is from the Python v3.1.2 documentation: From The Python Language Reference Section

  • 0

The following is from the Python v3.1.2 documentation:

From The Python Language Reference Section 3.3.1 Basic Customization:

object.__hash__(self)

... User-defined classes have __eq__() and __hash__() methods 
by default; with them, all objects compare unequal (except
with themselves) and x.__hash__() returns id(x).

From The Glossary:

hashable

... Objects which are instances of user-defined classes are 
hashable by default; they all compare unequal, and their hash 
value is their id().

This is true up through version 2.6.5:

Python 2.6.5 (r265:79096, Mar 19 2010 21:48:26) ...
...
>>> class C(object): pass
...
>>> c = C()
>>> id(c)
11335856
>>> hash(c)
11335856

But in version 3.1.2:

Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) ...
...
>>> class C: pass
...
>>> c = C()
>>> id(c)
11893680
>>> hash(c)
743355

So which is it? Should I report a documentation bug or a program bug?
And if it’s a documentation bug, and the default hash() value for a user
class instance is no longer the same as the id() value, then it would be
interesting to know what it is or how it is calculated, and why it was
changed in version 3.

  • 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-15T13:02:49+00:00Added an answer on May 15, 2026 at 1:02 pm

    I’m guessing this was a change made in Python 3.x to improve performance. Check out issue 5186, then look a little more closely at your mismatched numbers:

    >>> bin(11893680)
    '0b101101010111101110110000'
    >>> bin(743355)
    '0b10110101011110111011'
    >>> 11893680 >> 4
    743355
    

    It’s probably worth reporting as a documentation bug.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Doctrine automatically hydrates related objects when you select fields from… May 16, 2026 at 1:30 am
  • Editorial Team
    Editorial Team added an answer You could also use CodeSmith templates for this purpose. Advantage… May 16, 2026 at 1:30 am
  • Editorial Team
    Editorial Team added an answer Was it System.Configuration.Configuration? Call WebConfigurationManager.OpenWebConfiguration with a file name to… May 16, 2026 at 1:30 am

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.