6/6 OOP & Classes in Python: Properties, Getter, Setter and Deleter | Attribute Validation and More

Поделиться
HTML-код
  • Опубликовано: 14 янв 2025

Комментарии • 21

  • @FabioMusanni
    @FabioMusanni  Год назад +2

    ⬇️ *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

  • @tangled55
    @tangled55 7 дней назад

    You are an amazing tutorial maker Fabio. Thank you so much.

    • @FabioMusanni
      @FabioMusanni  7 дней назад

      Thank you so much for the comment! ❤🤗

  • @LMFAO_FAN_2004
    @LMFAO_FAN_2004 2 месяца назад

    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.

    • @FabioMusanni
      @FabioMusanni  Месяц назад

      That's great! Well done! 💪👍

  • @xfd
    @xfd Год назад +4

    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!

    • @FabioMusanni
      @FabioMusanni  Год назад +1

      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 💪

    • @xfd
      @xfd Год назад

      @@FabioMusanni Will do! 😎

  • @emammadov
    @emammadov Год назад +2

    great explanation. thanks!!

    • @FabioMusanni
      @FabioMusanni  Год назад

      Thank you for the comment! Glad you liked it! 💪😍

  • @amarmusovic7748
    @amarmusovic7748 7 месяцев назад

    Great series. Thanks! 🤩

    • @FabioMusanni
      @FabioMusanni  7 месяцев назад

      Thank you for all the comments!! Really appreciated! 😍💪 Glad you enjoyed it! 😎

  • @ronboprime
    @ronboprime 10 месяцев назад

    thanks so much for this video! finally, a good explanation!

    • @FabioMusanni
      @FabioMusanni  9 месяцев назад

      I'm glad you found the video helpful and clear! 💪😊

  • @pushpendra1379
    @pushpendra1379 5 месяцев назад

    Thanks alot i wondering for good explanation of getter shutter but i get best one ❤

    • @FabioMusanni
      @FabioMusanni  5 месяцев назад

      Glad you liked it! ❤💪

  • @QuintinMassey
    @QuintinMassey Год назад +1

    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.

    • @FabioMusanni
      @FabioMusanni  Год назад

      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.

  • @StarChild.no1
    @StarChild.no1 Год назад

    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?

    • @FabioMusanni
      @FabioMusanni  Год назад +1

      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.

  • @fpanfilo
    @fpanfilo Год назад

    I found the class non really clear