A programming language without pointers!!! Is that even possible??

Subhomoy Chattopadhyay
2 min readOct 11, 2020

No Pointers!! Only Python!!

Image source: Real Python

Python does not have pointers! Yes you read it right!

Pointer is the most scary thing among programmers. In any interview you go for job switching or as a fresher there will be at least one question from pointer with respect to the language mentioned in your CV. But if you mentioned python as the programming language you know then probably you got rid of that pointer thing. It is really easy to make someone confused by asking about pointer, memory allocations in heap and stack, memory freeing from heap etc. if C++,C are your known programming languages.

But Python made the programmer’s life much easier. We do not have to think about any of those mentioned above. The memory will get allocated and deallocated dynamically in heap by using some beautiful data structures available in Python. In C or C++ we are afraid of the ‘*’ operator which is used for pointer and pointer arithmetic.

In Python when we assign a value to a variable we basically create a view. It can be shown by one example.

Here it is clearly shown that both ‘a’ and ‘b’ are just views created of the value 12. If the addresses of them are printed by using a top level python in-built function ‘id()’ we get the same memory location. But in C or C++ we can not even imagine it!! So how are you feeling about Python not having a pointer??!!

The next and most important thing about not having a pointer is removal of memory leakage issues. Most of the times the developers have to break their heads because of this nightmare. But in Python the heap memory is used and freed dynamically unlike C++ or C. If use use dynamic memory allocation by using ‘new’ operator in C++ or malloc in C, you must have to use ‘delete’ and ‘free’ respectively to release the heap memory after using it. And if you unfortunately forget it anytime you are going to get an escalation soon from the client. But in Python we just do not have to think about it.

So it is pretty clear now that it is always good and easy to learn a language without pointers. What do you guys think about it? Are you thinking the same way I am thinking!? Hope you are getting enough reason now to learn Python right??

As always thanks for reading!! Stay tuned for more updates….

--

--