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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:02:39+00:00 2026-06-04T04:02:39+00:00

I want a data type that will allow me to efficiently keep track of

  • 0

I want a data type that will allow me to efficiently keep track of objects that have been “added” to it, allowing me to test for membership. I don’t need any other features.

As far as I can tell, Python does not have such a datatype. The closest to what I want is the Set, but the set will always store values (which I do not need).

Currently the best I can come up with is taking the hash() of each object and storing it in a set, but at a lower level a hash of the hash is being computed, and the hash string is being stored as a value.

Is there a way to use just the low-level lookup functionality of Sets without actually pointing to anything?

  • 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-04T04:02:40+00:00Added an answer on June 4, 2026 at 4:02 am

    Basically, no, because, as I pointed out in my comment, it is perfectly possible for two unequal objects to share the same hash key.

    The hash key points, not to either nothing or an object, but to a bucket which contains zero or more objects. The set implementation then needs to do equality comparisons against each of these to work out if the object is in the set.

    So you always need at least enough information to make an equality comparison. If you’ve got very large objects whose equality can be decided on a subset of their data, say 2 or 3 fields, you could consider creating a new object with just these fields and storing this in the set instead of the whole object.

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

Sidebar

Related Questions

I want to build a bookmarklet that will allow me to send the URL
I'd like to write an import driver that will allow my proprietary file type
I want to stack this type of my data set: PATIENT_ID AA BB CC
Ok bit of a newbie type question. I want to use Core Data, together
I want to data mine dribbble.com so I can make an app that registers
I want to create a database structure that will has good efficiency. Now database
When designing a web service that will allow the consumer of the service to
I have an issue with javascript/jQuery...I have a web service that will process information
I want to allow the user to define a query which will be used
I have a object with a data type of float, I need to change

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.