[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –
Python Programming Tutorial – 31 – Class vs Instance Variables
by
Tags:
Comments
46 responses to “Python Programming Tutorial – 31 – Class vs Instance Variables”
-
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
-
so this means in the previous videos – the enemy class everything after, life =3 are all instances right?
-
Hey bucky ,
you can still changethe value of gender right?
class Girl:
gender = "female"
def __init__(self,name,new_gender):
self.name = name
self.gender = new_gendergirl1 = Girl("Mocha","Transgender")
print(girl1.gender) -
do we need to put a parenthesis after the name of class? or is it only important during inheritance
-
Thanks! love how you explained this!
-
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!
-
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)
-
Great tutorials!!!!!
-
bitches are triggered….stay away from comment section.
-
why no more 1080 p ?!!!!!!
-
Women are not objects, Bucky! Pig!
-
I'm triggered. I'll have you know gender is NON BINARY. STUPID CIS MALE.
–
–
–
–
–
–
I'm obviously joking lmao fuck feminism. -
Thanks
-
Brilliant. Thank you much. Can Python classes inherit from classes in another module or package module? Any idea?
Thanks -
where are GUI tutorials
-
You haven't enabled the subtitles for the 30 and 31 tutorial
-
I was so hoping for a Monica or a Phoebe after Rachel….
I am disappointed -
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
-
What kind of editor are you using? Looks good, didn't find it in Google right away.
-
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
-
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!!
-
What if the girl is gender fluid?
-
Thank you. Simple the best!!!
-
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 ? -
can i have multi constructor with different numbers of parameters?
-
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
-
These tutorials are awesome dude. Thanks
-
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? -
Thank Bucky
-
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?
-
HOW DARE YOU CALL A GIRL AN OBJECT YOU MISOGYNISTIC PIG!!
Muhh patriarchy -
So long for encapsulation, eh?
-
Ok so how to change gender via inner method ?
-
very helpful thanks !
-
Wholly crap. My teacher spend a whole class on this. Its never made sense until now! So simple!
Thanks your a boss!
-
Great video but Idk why I felt really offended each time he said each girl or each object.
-
Awesome
-
why is it not self.gender?
-
shame on you bucky, you are objectivesing the womens
-
Like always bright as the sun!
-
hey bucky , how are you?
i hope u finelook , 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 usefulI 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 🙂
-
"Each girl or each object" lol
-
In the long run (career, money, fun, etc.) who wins: c# asp.net or python django?
-
You really have a great talent at making some difficult topics simple. Thanks.
-
What happens if you make an instance with no name?
Leave a Reply