Wow gotta say the best video ever. I wish he was my programming professor. To be honest programmers on UA-cam are better than some professors we have in the U.S universities.
class Payment: def __init__(self, price): self.__final_price = price + price * 0.02 book = Payment(100) book.__final_price = 0 print(book.__final_price) output - 0 the value of the final_price variable is changing what's happening?
it is not changing it is basically creating one more __final_price and setting that to zero ,if you create a show function and reutrn self.__final_price you will notice that it hasnt changes , finally print(objectname.__dict__) to understnad better
gr8 explanation , thanks for uploading I have a doubt however , when i tried to access the pvt variable it gave an error as expected but it also suggest to use objectname._A__name , meaning I am able to edit the pvt variable using it , can somone pls tell how we can prevent that ```class A: def __init__(self, name): self.__name = name def show(self): return self.__name def setter(self,newname): self.__name = newname a = A("akash") a.setter("lokesh") a._A__name = "tommy" print(a.show())``` >>>tommy
Can't believe a level 9999 Indian overlord explained this way better in 8 minutes than my top ranked college did.
Thanks for your love and support, keep learning. Join bitfumes telegram group t.me/bitfumes
How to detect scammers or bullshit videos, 1: speaker is Indian.
@@ElamW-bz3jt what's wrong with you ?
Thank you mister, finally I'm able to use proper encapsulation in python!
Wow gotta say the best video ever. I wish he was my programming professor. To be honest programmers on UA-cam are better than some professors we have in the U.S universities.
thank you, short, simple and clear
Crystal clear explanation! Salute to you sir.
Excellent explanation
VERY well explained, thank you!
class Payment:
def __init__(self, price):
self.__final_price = price + price * 0.02
book = Payment(100)
book.__final_price = 0
print(book.__final_price)
output - 0
the value of the final_price variable is changing what's happening?
it is not changing it is basically creating one more __final_price and setting that to zero ,if you create a show function and reutrn self.__final_price you will notice that it hasnt changes , finally print(objectname.__dict__) to understnad better
Amazing tutorial
Glad you liked it
Smooth bruh
thanks
Thanks for watching, please subscribe and like this video
hello!! , you didnt explain about the 9th line , kindly check and try to explain what u have done in the line 9 in your code>
love your vid, thanks
Thanks ❤❤❤❤ lot you made it very easy 😊 where from buddy
Thanks for your love and support, keep learning. Join bitfumes newsletter bitfumes.com/newsletters
A better explanation but not quite easy.
loved the way you teach , do you have anything for Django also?? (videos playlist)
Not now, but will start soon
Thanks a lot
That's awesome
Love you boss 😘
Thanks for watching, please like Bitfumes on facebook/twitter for more updates.
6:24, how are you using the 'discount' parameter without instantiating it?
book is instantiated in line 11
gr8 explanation , thanks for uploading
I have a doubt however , when i tried to access the pvt variable it gave an error as expected but it also suggest to use objectname._A__name , meaning I am able to edit the pvt variable using it , can somone pls tell how we can prevent that ```class A:
def __init__(self, name):
self.__name = name
def show(self):
return self.__name
def setter(self,newname):
self.__name = newname
a = A("akash")
a.setter("lokesh")
a._A__name = "tommy"
print(a.show())```
>>>tommy
You changed the 9th line into commentary. If you hadn't done that, the final price would've still been changed.
That some bad teaching here. >:(
Single underscore is protected. And double is private. Stop fooling. Its nothing such thing like warning
you might be from different language, so you think it is type of foolish or else if you are from python domain, learn about access specifiers
your problem is you are a joke. single underscore is protected but it is not enforced when you use it outside thats why it is acting as a warning
Thank you very much