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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:05:53+00:00 2026-06-03T04:05:53+00:00

I’m very comfortable with .NET objects and its framework for reference vs value types.

  • 0

I’m very comfortable with .NET objects and its framework for reference vs value types. How do python objects compare to .NET objects? Specifically, I’m wondering about equality obj1 == obj2, hash-ability (i.e. being able to put in a dict), and copying.

For instance, by default in .NET, all objects are reference types and their equality and hash code is determined by their address in memory. Additionally, assigning a variable to an existing object just makes it point to that address in memory, so there is no expensive copying occurring. It seems that this is the same for python, but I’m not entirely sure.

EDITS:

  • Equality
    • is checks for referential equality, == checks for value equality (but what does value equality mean for objects?)

I was able to find some useful info from the effbot written back in 2000:

Objects

All Python objects have this:

  • a unique identity (an integer, returned by id(x))
  • a type (returned by type(x))
  • some content You cannot change the identity.

You cannot change the type.

Some objects allow you to change their content (without changing the
identity or the type, that is).

Some objects don’t allow you to change their content (more below).

The type is represented by a type object, which knows more about
objects of this type (how many bytes of memory they usually occupy,
what methods they have, etc).

  • 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-06-03T04:05:54+00:00Added an answer on June 3, 2026 at 4:05 am

    Equality

    :
    – An object with no __cmp__ or __eq__ method defined will raise an error if you try to compare it inherits its comparisons from the object object. This means that doing a > b is equivalent to doing id(a) > id(b).

    The is keyword is also used to see if two variables point to the same object. The == operator on the other hand, calls the __cmp__ or __eq__ method of the object it is comparing.

    Hashability

    :
    – An object is hashable if there is a __hash__ method defined for it. All of the basic data types (including strings and tuples) have hash functions defined for them. If there is no __hash__ method defined for a class, that class will inherit it’s hash from the object object.

    Copying

    :
    – copy, copy.deepcopy, and their respective in class methods __copy__ and __deepcopy__. Use copy to copy a single object, deepcopy to copy a heirarchy of objects. deepcopy

    Edits made at the suggestion of agf.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

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.