⬇️ *LEARN ON THE BEST LEARNING PLATFORMS (LINKS BELOW)* 😉💪 ⬇️ ☕ *Buy me a coffee:* www.buymeacoffee.com/fabiomusanni ❤️ *Support me monthly:* www.patreon.com/FabioMusanni 😍 *One-off donation:* www.paypal.me/FabioMusanni/ *SKILLSHARE* _(Python, Web Dev, UI/UX Design, Music, Art, Animation and a lot more)_ 🔗 skillshare.eqcm.net/5gxzD2 (Affiliate) *DATACAMP* _(Python, ChatGPT, SQL, Power BI, and a lot more)_ 🔗 datacamp.pxf.io/vN1bDj (Affiliate) *COURSERA PYTHON* _(For beginners, Data Science, Data Analysis, AI, Cybersecurity and a lot more):_ 🔗 imp.i384100.net/k0Nk60 (Affiliate) *COURSERA WEB DEVELOPMENT* _(Full Stack, Front-End, Back-End, Web Design and a lot more):_ 🔗 imp.i384100.net/EKWxBW (Affiliate) Thank you for the support!❤ 🎥OOP & Classes Playlist: ruclips.net/p/PLs8qUrmRvaR2LSaVLSvAGykNexBLrRqNt 🎥All my videos about Python: ruclips.net/p/PLs8qUrmRvaR0IT4IwJl-LSweAdACW-yLK
thanks. my setters were claiming that I needed to pass a parameter even though the only parameter I had in the function was self. Got frustrated, came back a week later, wrote the same code, and it worked.
Great tutorial. I watched so many tutorials but none of them addressed why they would use self.age (without an underscore once using a setter), which left me super confused. Thanks!
Thank you for the comment! 😍 I'm glad I could clarify the doubts you had about this tricky concept. If you haven't already, I'd highly recommend you watch the whole series I made about OOP and Classes (which this video is part of), you definitely will get a lot out of it 💪
Correction: age: public _age: protected __age: name mangling (kind of like defining a namespace variable for a class in C++) Other than that, thank you. Showing hope to get past the maximum recursion error was really helpful.
Hello, thank you for the comment 😊 What you said is correct but I don't understand the correction, since it's what I've always said. I also made a video (ruclips.net/video/L-uFwUJ95bY/видео.html) where I talk about private variables and name mangling in Python in more detail. Consider that private variables in Python work differently than private/protected variables in other languages, in Python it's just like a sort of warning "Use it only inside the class" but you can still access them from wherever anyway, they are not really private.
When using class attributes instead of instance variables, (my attributes are initialized inside the class by a database method), using the _privateVar, converts it from a variable type to a function.. That aside, if you have 30 attributes to get and set, do you create 30 getters and setters, or do you create the getter and setter once and call them to set each variable? My problem is that they can be different variable types so how will a setter handle such a situation?
Hello 😊 If you have different attributes, as far as I know, they have to have their own setter, getter and deleter. It would be quite difficult (probably impossible) to have just one for a lot of attributes also because the names need to match.
⬇️ *LEARN ON THE BEST LEARNING PLATFORMS (LINKS BELOW)* 😉💪 ⬇️
☕ *Buy me a coffee:* www.buymeacoffee.com/fabiomusanni
❤️ *Support me monthly:* www.patreon.com/FabioMusanni
😍 *One-off donation:* www.paypal.me/FabioMusanni/
*SKILLSHARE*
_(Python, Web Dev, UI/UX Design, Music, Art, Animation and a lot more)_
🔗 skillshare.eqcm.net/5gxzD2 (Affiliate)
*DATACAMP*
_(Python, ChatGPT, SQL, Power BI, and a lot more)_
🔗 datacamp.pxf.io/vN1bDj (Affiliate)
*COURSERA PYTHON*
_(For beginners, Data Science, Data Analysis, AI, Cybersecurity and a lot more):_
🔗 imp.i384100.net/k0Nk60 (Affiliate)
*COURSERA WEB DEVELOPMENT*
_(Full Stack, Front-End, Back-End, Web Design and a lot more):_
🔗 imp.i384100.net/EKWxBW (Affiliate)
Thank you for the support!❤
🎥OOP & Classes Playlist: ruclips.net/p/PLs8qUrmRvaR2LSaVLSvAGykNexBLrRqNt
🎥All my videos about Python: ruclips.net/p/PLs8qUrmRvaR0IT4IwJl-LSweAdACW-yLK
You are an amazing tutorial maker Fabio. Thank you so much.
Thank you so much for the comment! ❤🤗
thanks. my setters were claiming that I needed to pass a parameter even though the only parameter I had in the function was self. Got frustrated, came back a week later, wrote the same code, and it worked.
That's great! Well done! 💪👍
Great tutorial. I watched so many tutorials but none of them addressed why they would use self.age (without an underscore once using a setter), which left me super confused. Thanks!
Thank you for the comment! 😍
I'm glad I could clarify the doubts you had about this tricky concept.
If you haven't already, I'd highly recommend you watch the whole series I made about OOP and Classes (which this video is part of), you definitely will get a lot out of it 💪
@@FabioMusanni Will do! 😎
great explanation. thanks!!
Thank you for the comment! Glad you liked it! 💪😍
Great series. Thanks! 🤩
Thank you for all the comments!! Really appreciated! 😍💪 Glad you enjoyed it! 😎
thanks so much for this video! finally, a good explanation!
I'm glad you found the video helpful and clear! 💪😊
Thanks alot i wondering for good explanation of getter shutter but i get best one ❤
Glad you liked it! ❤💪
Correction:
age: public
_age: protected
__age: name mangling (kind of like defining a namespace variable for a class in C++)
Other than that, thank you. Showing hope to get past the maximum recursion error was really helpful.
Hello, thank you for the comment 😊
What you said is correct but I don't understand the correction, since it's what I've always said. I also made a video (ruclips.net/video/L-uFwUJ95bY/видео.html) where I talk about private variables and name mangling in Python in more detail.
Consider that private variables in Python work differently than private/protected variables in other languages, in Python it's just like a sort of warning "Use it only inside the class" but you can still access them from wherever anyway, they are not really private.
When using class attributes instead of instance variables, (my attributes are initialized inside the class by a database method), using the _privateVar, converts it from a variable type to a function..
That aside, if you have 30 attributes to get and set, do you create 30 getters and setters, or do you create the getter and setter once and call them to set each variable? My problem is that they can be different variable types so how will a setter handle such a situation?
Hello 😊
If you have different attributes, as far as I know, they have to have their own setter, getter and deleter. It would be quite difficult (probably impossible) to have just one for a lot of attributes also because the names need to match.
I found the class non really clear