Python Forum
what is the __dict__ object?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what is the __dict__ object?
#3
>>> class A:
... pass
...
>>> class B:
... pass
...
>>> print(A.__dict__ is B.__dict__,A.__dict__ == B.__dict__,id(A.__dict__),id(B.__dict__))
False False 139925069297848 139925069297848

why id(A.__dict__) = id(B.__dict__),but A.__dict__ is not B.__dict__?
i think if id() function gives the same address for two objects,they must be the same object.
what is wrong here?
Reply


Messages In This Thread
what is the __dict__ object? - by aaron1989041 - Mar-28-2018, 02:44 AM
RE: what is the __dict__ object? - by Larz60+ - Mar-28-2018, 05:53 AM
RE: what is the __dict__ object? - by snippsat - Mar-28-2018, 01:32 PM
RE: what is the __dict__ object? - by wavic - Mar-28-2018, 03:25 PM
RE: what is the __dict__ object? - by aaron1989041 - Mar-29-2018, 02:15 AM
RE: what is the __dict__ object? - by Gribouillis - Mar-29-2018, 05:18 AM
id() function is strange - by aaron1989041 - Mar-28-2018, 09:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  __dict__ in math library akbarza 6 1,104 Sep-28-2023, 08:23 AM
Last Post: buran
  dict and __dict__ cls0724 1 2,799 Apr-05-2020, 07:45 PM
Last Post: Mateusz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020