Aug-22-2021, 11:39 AM
Here's something fundamental that I don't understand about the Object Oriented paradigm and I could do with some discussion on this. Obviously I am a novice but I am studying UK A level Computer Science so I'm a year into Python coding.
I can easily create a class and provide it with some instance attributes.
I can create a number of objects and print a memory location for each one (this shows me that each object is distinct with it's own location).
I can print the object attributes.
It seems quite common to copy the object attributes into a list or a dictionary for processing elsewhere.
What I don't understand is this:
How do I alter the object attributes in the object (in memory) rather than in the resulting list?
Do I even need to do that?
I can't see through this. When I look at example code here and there, I see that the list might be upgraded but that's not the object is it...it's a list! How do I get back to an object in memory and change that? I'm not even sure if I would need to do that but why create an object in memory if you don't want to work on it somewhere along the line. Why not just work on a list in the first place?
It is common to save the list of object attributes to a file so they can be reused later but when they are reloaded, are they objects or are they just a list of attributes?
I know this is rather fundamental but I don't understand it and I want to.
I don't think I need to upload any code for this question but I can provide some if needed. Let me know
Thanks in advance
I can easily create a class and provide it with some instance attributes.
I can create a number of objects and print a memory location for each one (this shows me that each object is distinct with it's own location).
I can print the object attributes.
It seems quite common to copy the object attributes into a list or a dictionary for processing elsewhere.
What I don't understand is this:
How do I alter the object attributes in the object (in memory) rather than in the resulting list?
Do I even need to do that?
I can't see through this. When I look at example code here and there, I see that the list might be upgraded but that's not the object is it...it's a list! How do I get back to an object in memory and change that? I'm not even sure if I would need to do that but why create an object in memory if you don't want to work on it somewhere along the line. Why not just work on a list in the first place?
It is common to save the list of object attributes to a file so they can be reused later but when they are reloaded, are they objects or are they just a list of attributes?
I know this is rather fundamental but I don't understand it and I want to.
I don't think I need to upload any code for this question but I can provide some if needed. Let me know
Thanks in advance