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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:41:55+00:00 2026-05-24T20:41:55+00:00

After an object has been created, I can add and remove slots at will,

  • 0

After an object has been created, I can add and remove slots at will, as I can do with a dictionary. Even methods are just objects stored in slots, so I probably can add methods to a dictionary as well.

Is there something I can do with a (non-dictionary) object that I could never do with a dictionary?
Or is it possible to set up a dictionary that completely looks like an object of a certain class?

This question is not about how they are created, but about how I can use them afterwards. Links or references are appreciated.

  • 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-24T20:41:57+00:00Added an answer on May 24, 2026 at 8:41 pm

    When you call member functions of an object, they get passed the object itself as a first parameter. This way they can modify properties of the object they belong to:

    class Counter(object):
       def __init__(self):
          self.num = 0
    
       def inc(self):
          self.num += 1
    
    count = Counter()
    count.inc()
    

    If you just store a bunch of functions in a dict, they will get no such support. You have to pass the dict around manually to achieve the same effect:

    def Counter_inc(d):
       d['num'] += 1
    
    def Counter_create():
       d = {
          'num': 0,
          'inc': Counter_inc,
       }
       return d
    
    count = Counter_create()
    count['inc'](count)
    

    As you can see while it is possible, it is much more clumsy. While you can emulate many features of object with raw dicts, having special language support for objects makes them easier to use.

    Also there are features that directly use an objects type information, like for example isinstance(), which cannot easily be replicated with raw dicts.

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

Sidebar

Related Questions

Just wondering how I can paste an object after I have selected it in
In Python, I have a Graph class that has a dictionary of vertex objects.
I sometimes get the following exception: COM object that has been separated from its
Is it possible to get the size(in bytes) of a Session object after storing
Is it necessary to check for nullptr after allocating an object using gcnew?
After creating a new object (Foo), I set the key (BarId) for an EntityRef
After initiating a new SimpleXml object: $xml = new SimpleXML($xmlStr); PHP errors out: Fatal
After writing code to populate textboxes from an object, such as: txtFirstName.Text = customer.FirstName;
After working with the .NET GDI+ Rectangle object, I've noticed that if I create
After the previous question What are the important rules in Object Model Design, now

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.