Please Explain This! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Please Explain This!

I Couldn't understand the difference between attributes beginning with single underscore and double underscore and how double underscore is strictly private.

24th Sep 2017, 2:20 PM
Lakshay
Lakshay - avatar
3 Answers
+ 4
theres no private or protected things in python.... so to make a apperent scene that any part of the code is protected or private we use single or double underscore... its like a sign to them who are using the code.. like suppose your mom said do not eat chocolate ..there will be teeth problems... but its like u can eat it if u dont want to listen to your mom... alike in python... its a sign ; a red cross.. **u cross this...you will be responcible for further happenings*** / ## HOPE YOU GOT IT ##/
24th Sep 2017, 3:19 PM
sayan chandra
sayan chandra - avatar
+ 1
@Sayan Thanks but I know all this and also that we cannot make outside class not to access the argument/method but what is the difference b/w the two as asked in the question?
24th Sep 2017, 4:43 PM
Lakshay
Lakshay - avatar
- 1
in cpp - java... theres fixed strict things to make code parts private or protected...
24th Sep 2017, 3:20 PM
sayan chandra
sayan chandra - avatar