6 Respostas
0
Pointers are variables that hold the memory address of nother variable... But Python does not support pointers, where is this quote from ?
0
It is from the computer science slides provided by my teacher. Thank you for your explanation!
0
I'm not a computer science student nor I have studied any of this in detail but what I think it means is that since python is built using c and c++ this may mean that we are actually storing the pointers of those values we want to store in lists. Please do correct me if I'm wrong.
0
Seems to me that saying python has "pointers" is wrong vocabulary, and this is kind of important to understand in depth how python works vs other languages that support it.
But it is true that lists and variables in python are just references to objects (everything in python is an object).
So based on the nature of python, i'd assume the quote means :
"Python can have heterogenous data types in its lists because those lists are just referencing locations of different objects (and those are not stored 'together') ".
It is almost the same, except for the use of "pointers", which is wrong imho.
0
You can find more detailed explanations if you look up how python or c stores information.
An example in python of the fact that python does not naturally support pointers :
a = 1
b = a
a = 2
b
---> will output 1, not 2
This would work (output 2) with pointers in C, which are actually "special" variables (you have to add * after the type iirc)
0
Thanks all of you. I have now understood that python does not support pointers. Im gonna take a look at how python store information