Python tricks: properties, staticmethods, and classmethods




[ad_1]

[https://www.buymeacoffee.com/cogsci] In this video I explain three decorators that are useful in object-oriented programming in Python: getter and setter properties, static methods, and class methods.

Source


[ad_2]

Comment List

  • Sebastiaan Mathôt
    November 24, 2020

    Great Content! Also Love ur FaceCam Style!!

  • Sebastiaan Mathôt
    November 24, 2020

    classmethod is for returning instances…

  • Sebastiaan Mathôt
    November 24, 2020

    U look like Nick Jonas

  • Sebastiaan Mathôt
    November 24, 2020

    Nicely done

  • Sebastiaan Mathôt
    November 24, 2020

    this was really helpful . thanks. please keep making tutorials. u are helping the community !! bless you

  • Sebastiaan Mathôt
    November 24, 2020

    Thanks Seba

  • Sebastiaan Mathôt
    November 24, 2020

    Dude… Thank you for existing. Very clear!

  • Sebastiaan Mathôt
    November 24, 2020

    How do you know so many trap artists.. haha

  • Sebastiaan Mathôt
    November 24, 2020

    Regarding staticmethod part:

    When I delete the "@staticmethod" line, the Code works in the Same way. Shouldnt it have some effect?

  • Sebastiaan Mathôt
    November 24, 2020

    Super CLEAR!

  • Sebastiaan Mathôt
    November 24, 2020

    Damn… So cool

  • Sebastiaan Mathôt
    November 24, 2020

    If you apply these types of examples in all your python videos, you can create a product that kids in inner cities can grasp onto.

  • Sebastiaan Mathôt
    November 24, 2020

    JUST WOOW

  • Sebastiaan Mathôt
    November 24, 2020

    Awesome man. So thanks

  • Sebastiaan Mathôt
    November 24, 2020

    thank you

  • Sebastiaan Mathôt
    November 24, 2020

    that moment when you say YOung Jeezy – In the mix……

  • Sebastiaan Mathôt
    November 24, 2020

    How do you use this method to match two dataframes

  • Sebastiaan Mathôt
    November 24, 2020

    Чувак, какой же ты крутой

  • Sebastiaan Mathôt
    November 24, 2020

    mooi! but why are you having those sunglasses 😛

  • Sebastiaan Mathôt
    November 24, 2020

    My red flag went up in the @classmethod discussion …

  • Sebastiaan Mathôt
    November 24, 2020

    Yoooo I'm super geeked and impressed with his knowledge of urban music! that's tight! good ish yo
    PS. Great explanation also….

    So the object, dunder class dunder hits (rr._class.__hits()) is a way around the "private" or mangled properties of certain attributes! Nice nice!

  • Sebastiaan Mathôt
    November 24, 2020

    I assume that random_artist() calls the class constructor TrapArtist in the return statement for this to work

  • Sebastiaan Mathôt
    November 24, 2020

    we want more !!

  • Sebastiaan Mathôt
    November 24, 2020

    This is an outstanding example that explained everything for me. Thanks !!

Write a comment