Python Programming Tutorial – 31 – Class vs Instance Variables

Home/Programming Video Tutorials/Python Video Tutorials/Python Programming Tutorial – 31 – Class vs Instance Variables

Python Programming Tutorial – 31 – Class vs Instance Variables

FavoriteLoadingAdd to favorites

Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts

By | 2017-06-21T03:25:47+00:00 June 21st, 2017|Python Video Tutorials|40 Comments

40 Comments

  1. Shudharsan Muthuraj June 21, 2017 at 3:29 am - Reply

    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!!

  2. uday173 June 21, 2017 at 3:29 am - Reply

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

  3. 석상주 June 21, 2017 at 3:30 am - Reply

    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

  4. ArashkG June 21, 2017 at 3:31 am - Reply

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






    I’m obviously joking lmao fuck feminism.

  5. Scientist June 21, 2017 at 3:32 am - Reply

    can i have multi constructor with different numbers of parameters?

  6. paul ready June 21, 2017 at 3:32 am - Reply

    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.name, r.gender)
    Rachel is a female
    >>> print "%s is a %s" %(s.name, s.gender)
    Stinky is a female
    >>> s.gender = "not known"
    >>> print "%s is a %s" %(r.name, r.gender)
    Rachel is a female
    >>> print "%s is a %s" %(s.name, s.gender)
    Stinky is a not known
    >>>

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

  7. Mike Morgan June 21, 2017 at 3:33 am - Reply

    These tutorials are awesome dude. Thanks

  8. Jelly Beaner June 21, 2017 at 3:35 am - Reply

    HOW DARE YOU CALL A GIRL AN OBJECT YOU MISOGYNISTIC PIG!!
    Muhh patriarchy

  9. NodeNull June 21, 2017 at 3:36 am - Reply

    Ok so how to change gender via inner method ?

  10. NotMarkKnopfler June 21, 2017 at 3:38 am - Reply

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

  11. Waleed Ahsan Sarfraz June 21, 2017 at 3:38 am - Reply

    where are GUI tutorials

  12. Free Woman June 21, 2017 at 3:38 am - Reply

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

  13. Berke Oral June 21, 2017 at 3:42 am - Reply

    shame on you bucky, you are objectivesing the womens

  14. Michael Perry June 21, 2017 at 3:44 am - Reply

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

    Thanks your a boss!

  15. Younes PhD Henni June 21, 2017 at 3:45 am - Reply

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

  16. PapiDimmi June 21, 2017 at 3:46 am - Reply

    You’re calling girls objects and assuming genders. Fucking misogynist!

  17. David C June 21, 2017 at 3:47 am - Reply

    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 ?

  18. Vinay Babu June 21, 2017 at 3:50 am - Reply

    bitches are triggered….stay away from comment section.

  19. Quang Nguyen June 21, 2017 at 3:50 am - Reply

    Thank you. Simple the best!!!

  20. Noor Aljibouri June 21, 2017 at 3:52 am - Reply

    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?

  21. Luke P June 21, 2017 at 3:54 am - Reply

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

  22. Arman Rüzgar Tokgöz June 21, 2017 at 3:55 am - Reply

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

  23. Ahmed Balfaqih June 21, 2017 at 3:56 am - Reply

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

  24. Pocket Man June 21, 2017 at 3:57 am - Reply

    Thanks

  25. Protoss Pylon June 21, 2017 at 3:57 am - Reply

    why is it not self.gender?

  26. Ngan Nguyen Ngoc June 21, 2017 at 3:59 am - Reply

    Thank Bucky

  27. Joe Pearson June 21, 2017 at 4:01 am - Reply

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

  28. HEMANT VERMA June 21, 2017 at 4:02 am - Reply

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

  29. SireBandi June 21, 2017 at 4:03 am - Reply

    What if the girl is gender fluid?

  30. Joseph Alhajri June 21, 2017 at 4:03 am - Reply

    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 🙂

  31. Constantine Ketskalo June 21, 2017 at 4:03 am - Reply

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

  32. Mike Chastain June 21, 2017 at 4:06 am - Reply

    What happens if you make an instance with no name?

  33. Elyria June 21, 2017 at 4:07 am - Reply

    Women are not objects, Bucky! Pig!

  34. Ethan Smith June 21, 2017 at 4:07 am - Reply

    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

  35. bedo1100 June 21, 2017 at 4:08 am - Reply

    "Each girl or each object" lol

  36. X Qiu June 21, 2017 at 4:16 am - Reply

    very helpful thanks !

  37. Nomik Guy June 21, 2017 at 4:16 am - Reply

    Like always bright as the sun!

  38. Alande Amorim June 21, 2017 at 4:24 am - Reply

    So long for encapsulation, eh?

  39. MicrowavedHumans June 21, 2017 at 4:24 am - Reply

    Awesome

  40. Aragog Yang June 21, 2017 at 4:25 am - Reply

    Bucky you are a tremendous awesome tutor!

Leave A Comment

*