Do we have pointers in python like other programming languages

0 votes
is there a difference between pointers in python and other programming language?

does pointers in python exist?
Mar 12, 2019 in Python by Waseem
• 4,540 points
62,493 views

2 answers to this question.

–1 vote
Hello

No, we don't have any kind of Pointer in Python language. The objects are passed to function by reference. The mechanism used in Python is exactly like passing pointers by the value in C. We have Python variables which is not a pointer.
answered Mar 12, 2019 by MrBoot
• 1,230 points
0 votes

From one point of view, everything is a pointer in Python. Your example works a lot like the C++ code. (A closer equivalent would use some type of shared_ptr<Object> instead of int* .)

Python doesn't need pointers in order to achieve this as every variable is a reference to an object. These references are slightly different from C++ references, in that they can be assigned to - much like pointers in C++. Python standard way of handling things supports you. In python every variable is a reference.

Hope this helps!!

If you need to learn more about Python, It's recommended to join Python Training today.

Thanks!

answered Dec 16, 2020 by Gitika
• 65,770 points

edited Jul 8, 2021 by Sarfaraz

Related Questions In Python

0 votes
2 answers

Why do we use return statement in python?

def maximum(x, y):     if x > y:     return x     else:    return ...READ MORE

answered Apr 4, 2019 in Python by anonymous
2,047 views
0 votes
1 answer

Why do variables have bigger scopes in Python than in C?

Only functions, modules, and the bodies of ...READ MORE

answered Jul 2, 2019 in Python by SDeb
• 13,300 points
1,075 views
+4 votes
6 answers

Does Python have a ternary conditional operator like C does?

Yes, the syntax is: a if condition else ...READ MORE

answered Apr 13, 2018 in Python by Nietzsche's daemon
• 4,260 points
2,508 views
+1 vote
7 answers
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,456 views
0 votes
1 answer
0 votes
1 answer

How can we do the below modulo operation in python guys?

Expecting some operations, not loop. As because of ...READ MORE

answered Oct 14, 2020 in Python by anonymous
• 65,770 points
857 views
0 votes
1 answer

Why do we not follow the "off by one" rule in python

It's because of the way in which ...READ MORE

answered Nov 15, 2020 in Python by Gitika
• 65,770 points
686 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP