Python Programming Tutorial – 31 – Class vs Instance Variables

Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –






46 responses to “Python Programming Tutorial – 31 – Class vs Instance Variables”

  1. Tom Nimanju Avatar

    That treehouse add is hilarious. "In college, I wasn't completely happy with…." Yeah, college is place where you should be completely happy with everything. Not being completely happy is #1 reason people drop out of college. lol

  2. Vignesh Padmanabhan Avatar

    so this means in the previous videos – the enemy class everything after, life =3 are all instances right?

  3. BasicCoding Avatar

    Hey bucky ,

    you can still changethe value of gender right?

    class Girl:
    gender = "female"
    def __init__(self,name,new_gender): = name
    self.gender = new_gender

    girl1 = Girl("Mocha","Transgender")

  4. kaustuv banerjee Avatar

    do we need to put a parenthesis after the name of class? or is it only important during inheritance

  5. Choua Lee Avatar

    Thanks! love how you explained this!

  6. Fhd Avatar

    what about if I want to assign a value to gender from inside a class method (or in init). I see that both Girl.gender = "female" and self.gender = "female" .. do the same job! Could you explain why? Thanks for the great tut!

  7. Oksana S Avatar

    Great explanation but would be even better if you told us if you can change this class variable while running the program and how to access them to change (I'm very new to Python)

  8. vinay vanteddu Avatar

    bitches are triggered….stay away from comment section.

  9. Younes PhD Henni Avatar

    why no more 1080 p ?!!!!!!

  10. Elyria Avatar

    Women are not objects, Bucky! Pig!

  11. ArashkG Avatar

    I'm triggered. I'll have you know gender is NON BINARY. STUPID CIS MALE.

    I'm obviously joking lmao fuck feminism.

  12. NotMarkKnopfler Avatar

    Brilliant. Thank you much. Can Python classes inherit from classes in another module or package module? Any idea?

  13. Waleed Ahsan Sarfraz Avatar

    where are GUI tutorials

  14. HEMANT VERMA Avatar

    You haven't enabled the subtitles for the 30 and 31 tutorial

  15. uday173 Avatar

    I was so hoping for a Monica or a Phoebe after Rachel….
    I am disappointed

  16. 석상주 Avatar

    A little bit confused of wording in this video because the state of class variable stays unique to every object instantiated. Check out Tutorial – 29 Class and Objects

  17. Constantine Ketskalo Avatar

    What kind of editor are you using? Looks good, didn't find it in Google right away.

  18. Ethan Smith Avatar

    why doesn't he include the shebang line? I know he's on windows and its not necessary, but it should still be there for compatibility and the like

  19. Shudharsan Muthuraj Avatar

    why are you printing names separately for each instance instead of having one print command inside the init function.. you can print all the instance names easily that way!!

  20. SireBandi Avatar

    What if the girl is gender fluid?

  21. Quang Nguyen Avatar

    Thank you. Simple the best!!!

  22. David C Avatar

    I have one question when create r , s object of Girl.
    normally it is r=Girl() if we want to pass value to object , just simply to put value inside of parentheses ?

  23. Scientist Avatar

    can i have multi constructor with different numbers of parameters?

  24. paul ready Avatar

    I have a question regarding a class variable. Where you have

    gender = "female"

    These only initialised and set when the class is created
    >>> r = Girl("Rachel")
    >>> s = Girl("Stinky")
    >>> print "%s is a %s" %(, r.gender)
    Rachel is a female
    >>> print "%s is a %s" %(, s.gender)
    Stinky is a female
    >>> s.gender = "not known"
    >>> print "%s is a %s" %(, r.gender)
    Rachel is a female
    >>> print "%s is a %s" %(, s.gender)
    Stinky is a not known

    What do you do if you want gender = "female" never to be changed or changeable

  25. Mike Morgan Avatar

    These tutorials are awesome dude. Thanks

  26. Noor Aljibouri Avatar

    what if I have list of class variable
    like VALID_RATING = ["G", "PG", "PG-13", "R"]
    in class_Movie i want every movie take one of valid rating??
    how i do this?

  27. Arman Rüzgar Tokgöz Avatar

    Why doesnt my code work when I write:
    name =
    instead of = name

  28. Luke P Avatar

    I'm not quite understanding why in the _init_ function you have to put = name instead of just name. Can anyone explain that to me?

  29. Jelly Beaner Avatar

    Muhh patriarchy

  30. Alande Amorim Avatar

    So long for encapsulation, eh?

  31. NodeNull Avatar

    Ok so how to change gender via inner method ?

  32. X Qiu Avatar

    very helpful thanks !

  33. Michael Perry Avatar

    Wholly crap. My teacher spend a whole class on this. Its never made sense until now! So simple!

    Thanks your a boss!

  34. Free Woman Avatar

    Great video but Idk why I felt really offended each time he said each girl or each object.

  35. Protoss Pylon Avatar

    why is it not self.gender?

  36. Berke Oral Avatar

    shame on you bucky, you are objectivesing the womens

  37. Nomik Guy Avatar

    Like always bright as the sun!

  38. Joseph Alhajri Avatar

    hey bucky , how are you?
    i hope u fine

    look , if you have all your video on your computer , why you don't zip ALL python tutorial and upload it on network ?
    easier to download & really interesting and useful

    I think , i'm from the people who watch your python tutorial in 2008 ! , why your voice don't change ? :v hehee

    so think about the zip 🙂

  39. bedo1100 Avatar

    "Each girl or each object" lol

  40. Joe Pearson Avatar

    In the long run (career, money, fun, etc.) who wins: c# or python django?

  41. Ahmed Balfaqih Avatar

    You really have a great talent at making some difficult topics simple. Thanks.

  42. Michael Wilding Avatar

    What happens if you make an instance with no name?

Leave a Reply

Your email address will not be published. Required fields are marked *