@ all the people who have been having the problem when they get to first.displayname() after you enter self.name=name, when your creating the class, when you return hit your left direction arrow and it will align the methods your making and should fix your problem if this makes sense and fixes your problem thumbs up so others can see
I keep doing exactly what you did, but for some reason I keep getting an error message whenever I try to use displayName or saying that says saying something about a bound method
Damn. Just looking at this in the Python textbook I bought, it would've taken AT LEAST a month to figure out. Thanks bro. 33 videos in one day. Tomorrow is a review of those 33, then moving forward. Someone should be paying you. Just sayin'.
@Dragalug You can of course call a function from another function. But I don't think it is possible to define a function from inside another function. After all, it is quite impractical. Why would you want to define a func. inside another function. Instead, you could, define it outside the function and call it inside the function. It gives the same result and is much more efficient and easier to read. Moreover now, you can also use it in any other place without calling the original func. HTH!!!!
for everyone that doesnt know yet, self has no special meaning to python, you can use "banana" to, but its a convention to use self. Self is there because when you activate a class by assigning it to a varialbe, that variable becomes an object and is passed as the first argument for every function in the class. thats y you have to start everything with self.
Bucky your the best teacher in the simplest form. I spent 4 months in class and I learn crap!!!! I spent 1hr watching your tutorial series and learn it 10x better than I did in class thanx bro man your the best!!
let me resay that. If you have power over the computer, you can make ANYTHING and i mean ABSOLUTELY ANYTHING possible in the little dream world i like to call the virtual space that is not really existant but changes lives. If anyone understands that, give it a thumbs up lol.
Soo, if "self" is used as a reference to the object you just created, then there must be something else like "public" or "static" that refers to the class, or in other words, all of the objects? That is so awesome!
so the 'self' parameter can be called anything since its just a variable for the object right? Couldn't I just use something like createName(obj,name) instead of createName(self,name)?
@CwisyLiu If you would use it in a separate function, for example, the first one would just print hello out and the main program wouldn't see it (it would just appear on the screen). The second case you mentioned wouldn't display it on the screen (in a real program, not Python GUI), but the main program would get that value and could use it in further functions or whatever... This sounds complicated but with some practice in programming it should be a snap :)
When your first watch these tutorials you think ("OH no not another tutorial series on programming\n") but then your like im.impressedWith(this) lol this guy should be a professor better then alot of real teachers I have had
You are awesome. I've tried 3 other tutorials and couldn't understand how the #$%in ".self" thing works. Only after your explanation did it finally start to make sense.
You are awesome. I've tried 3 other tutorials and couldn't understand how the #$%in ".self" thing works. Only after your explanation did it finally start to make sense.
I think you made a confusing mistake @3:49. The "name" in self.name doesn't get bound to the argument "name" of the createName method, so you don't end up with first.bucky="bucky", it's still self.name. it would probably be less confusing to make the argument name differ from the attribute name being set.
You sort of corrected yourself, but not until 6:55... in case anyone else was confused by that.
its a placeholder for a string (%s for string i think its %d for an integer) so u write %s in the text u want to print out and after the string u put % and then the name of the string u want to use in this case self.name
Can you call the variables/attributes from other methods and use them in different methods of the class or do they work like local variables like in C++
Wow, u are amazing. I have been looking all over online trying to learn what classes meant and what they are used for. Your tuts 32 & 33 totally just made it click for me. You da man.
I Love your tutorials. I was familiar with Python, but your tutorials were really helpful in clearing some of my doubts. I really appreciate your patience in making these tutorials. :)
Thanks man, I understand things much more easily coming from you than my college professors. I will most likely be watching many more of your tutorials.
I have a question for you, do you know if visual studio supports python? also if python nterfaces with API of windows with forms or similar ..I see that python is very easy to work compared with #c and #c++..thank you..PJ
They are not required, but yes they can if you want to include all from others class. Still whatever you define for objects inside your class will overwrite values from inherritated class if they confront.
@pimpmobile999 it is used to print out a string or other value from a variable, particularly in a printed message. Which means that it's not necessarily a variable, but a way for a result to be printed as part of a message.
Its strange that you can create an object variable inside a method.. I mean, you didn't define "name" as a variable in the class, but you can assign it in a method.. hmm, that's very weird, I wonder why they made it like that.
self's the class "itself". if you create an object, the object actually takes over everything what is "self" in the class. that's why you don't have to pass 2 parameters...
for some reason keep getting this
AttributeError: cn instance has no attribute 'dn' please help
ckingz850587 1 week ago
I hope no one sees me watching this... -.-
superearthbender 3 weeks ago
Python 3 adds (self) automatically so it's just funny how he stresses the importance of it :) This is the case atleast on Eclipse with Pydev.
Nikotiini69 4 weeks ago in playlist Python Programming Tutorials
great tutorial! makes me less intimidated to try to program in object oriented after getting so used to structured programming.
hlnio 1 month ago
This is the first time I've been really confused in python.
cvs333 1 month ago
@cvs333 Why are you confused? It is quite clear I think. Rewatch and try it out couple of times. It's really easy.
Nikotiini69 4 weeks ago in playlist Python Programming Tutorials
@Nikotiini69 Same with cvs333. I don't get it; what is the purpose of classes? What do they do?
sheensheensheensheen 4 weeks ago
@ all the people who have been having the problem when they get to first.displayname() after you enter self.name=name, when your creating the class, when you return hit your left direction arrow and it will align the methods your making and should fix your problem if this makes sense and fixes your problem thumbs up so others can see
Baseball3456789 1 month ago
@TheNanoStuff I got the same problem, the problem is you're not putting in the empty (), hope this helps!
dorseyman2011 1 month ago
make sure you have ' name = "" ' after the 'class className:' statement
supersushi269 1 month ago
don't understand... and how do I do the 'saying' in python 3?
enditend 2 months ago
I keep doing exactly what you did, but for some reason I keep getting an error message whenever I try to use displayName or saying that says saying something about a bound method
TheNanoStuff 2 months ago in playlist Python Programming Tutorials
I like how you sets the names for example the class. Makes it a whole lot easier to understand. Great work man! keep it up
TheBlueBear1337 2 months ago
Damn. Just looking at this in the Python textbook I bought, it would've taken AT LEAST a month to figure out. Thanks bro. 33 videos in one day. Tomorrow is a review of those 33, then moving forward. Someone should be paying you. Just sayin'.
v1k1n95 2 months ago
You've just cleared up days of frustrating research in only 7 mins. Great explanation! Subscribed!
s12racing 2 months ago
YES! I finally understand how classes work!! I love you.
ALacunae 2 months ago
more examples on class & self, please
francisgan9ut 2 months ago
This is getting hard for somebody who doesn't speak english natively :P, but i can follow it. Thanks for the great tutorials, all of them.
TTTNLify 2 months ago in playlist Python Programming Tutorials
Bucky4pres!
IPurplePro 3 months ago
Thanks for the tutorial!!! really helped :)
Pownyan 3 months ago
Thanks for the tutorials man. This will surely help me out for my class at UT
Wolfblade1992 3 months ago in playlist Python Programming Tutorials
Holy crap this is eating my hard drive space!
xDarkness227 4 months ago
Awesome tut's keep up the good work.
Skateboss3 4 months ago
This has been flagged as spam show
6:01 FIRST FIRST FIRST!!!! Oh damn...I am 51915th....
sorry....
Fangornmmc 5 months ago
6:01 FIRST FIRST FIRST!!!! Oh damn...I am 51915th....
sorry....
Fangornmmc 5 months ago 3
I would have put these tutorials in a different order
Regginyaga 5 months ago in playlist Python Programming Tutorials
Can you have a function within a function?
Dragalug 5 months ago
@Dragalug technically yes...why not try it out youself? Be warned, it might be a recursion depending on exactly what it calls on.
louisrocks40 5 months ago
@Dragalug You can of course call a function from another function. But I don't think it is possible to define a function from inside another function. After all, it is quite impractical. Why would you want to define a func. inside another function. Instead, you could, define it outside the function and call it inside the function. It gives the same result and is much more efficient and easier to read. Moreover now, you can also use it in any other place without calling the original func. HTH!!!!
achuaditi 5 months ago
for everyone that doesnt know yet, self has no special meaning to python, you can use "banana" to, but its a convention to use self. Self is there because when you activate a class by assigning it to a varialbe, that variable becomes an object and is passed as the first argument for every function in the class. thats y you have to start everything with self.
tyinykiller5 6 months ago 6
which tut is on files...playing with em and they are troublesome
MrFirminVernege 6 months ago
good job, you always know what the audience is thinking
teddakdag 7 months ago
The best
U4GMike 7 months ago 2
Best tutorials on the net.
abotroll 7 months ago 5
I LOVE YOU SO FREAKIN MUCH.
EggHeadShooter 7 months ago 4
Bucky your the best teacher in the simplest form. I spent 4 months in class and I learn crap!!!! I spent 1hr watching your tutorial series and learn it 10x better than I did in class thanx bro man your the best!!
flypilot43 7 months ago 4
'self' is like saying 'this' in java or c++, maybe it helps
wfreefall991 7 months ago 3
let me resay that. If you have power over the computer, you can make ANYTHING and i mean ABSOLUTELY ANYTHING possible in the little dream world i like to call the virtual space that is not really existant but changes lives. If anyone understands that, give it a thumbs up lol.
louisrocks40 8 months ago 58
@louisrocks40 exactly, that's why I am so addicted to computers for 8 years now.
1Alino 4 months ago in playlist Python TheNewBoston
@louisrocks40 Yeah, but there are probably limits to the quality of gpus and cpus due to heat. This would limit what you could do with code.
D3THFAN 2 months ago
@louisrocks40 you mean Minecraft? LOL
thewillyagami123 2 months ago
I hope you live a long and happy, healthy life! You have helped everyone achieve their dreams.
louisrocks40 8 months ago 5
I can not thank you enough. I have been trying to learn classes for the longest time and FINALLY I freaking understand them. Thanks SO much.
webdavexplot 8 months ago
Thanks a lot
dannemro 8 months ago
jus took a bunch of notes off of this to help me on my python Final lol Thank you~~!!!
stevicerated 9 months ago
6:00 reminds me of the average youtube commenter.
WASDsweden 9 months ago 4
Soo, if "self" is used as a reference to the object you just created, then there must be something else like "public" or "static" that refers to the class, or in other words, all of the objects? That is so awesome!
NikkexD 10 months ago
Great!!! God bless you!
b4shailen 10 months ago
Self self self self self
First first first first first
That tutorial wasn't confusing at all!
Supertoad25 10 months ago
Thank you bro
Freakskillua 10 months ago
FUCKIN THANK YOU BROO!!!!!!1
serpentphoenix 11 months ago
6:00 That's exactly how the first 10 comments are on all YouTube videos :)
ReDespawn 11 months ago 3
@ReDespawn I dont get it
giza182 10 months ago
so the 'self' parameter can be called anything since its just a variable for the object right? Couldn't I just use something like createName(obj,name) instead of createName(self,name)?
dylanXdisaster 11 months ago
Thaks very much for your explanations in OOP using Python. You made my learning process much easier. Thanks very much indeed.
vieites2006 11 months ago
@vieites2006
giza182 10 months ago
What is the difference between:
def example1:
print ("hello")
and
def example2:
return ("hello")
They seem like the same thing...
CwisyLiu 1 year ago
@CwisyLiu If you would use it in a separate function, for example, the first one would just print hello out and the main program wouldn't see it (it would just appear on the screen). The second case you mentioned wouldn't display it on the screen (in a real program, not Python GUI), but the main program would get that value and could use it in further functions or whatever... This sounds complicated but with some practice in programming it should be a snap :)
IanTheSecondComing 1 year ago
@CwisyLiu the print keyword prints out what you put in its parameters, so
print("hello")
'hello'
the return keyword returns a value from the method, so
def returnHello: return("Hello")
x = returnHello()
print x
'Hello'
VRCkid11 1 year ago
When your first watch these tutorials you think ("OH no not another tutorial series on programming\n") but then your like im.impressedWith(this) lol this guy should be a professor better then alot of real teachers I have had
numba1netsfan 1 year ago
This has been flagged as spam show
You are awesome. I've tried 3 other tutorials and couldn't understand how the #$%in ".self" thing works. Only after your explanation did it finally start to make sense.
you should be a college professor for python!!
SMERSH009X 1 year ago
You are awesome. I've tried 3 other tutorials and couldn't understand how the #$%in ".self" thing works. Only after your explanation did it finally start to make sense.
you should be a college professor for python!!
SMERSH009X 1 year ago
I think you made a confusing mistake @3:49. The "name" in self.name doesn't get bound to the argument "name" of the createName method, so you don't end up with first.bucky="bucky", it's still self.name. it would probably be less confusing to make the argument name differ from the attribute name being set.
You sort of corrected yourself, but not until 6:55... in case anyone else was confused by that.
Ormaaj 1 year ago
Nice tutorial i have been reading on objects for the last week and yours was by far the most helpful. much respect!!!
blazedone26 1 year ago
Oh my god!! I got it ALL AT ONCE at 6:39 lol i have no idea why. THANKS bucky, i subbed, u totally deserve it.
asfadasfa1234 1 year ago
This has been flagged as spam show
If you really want to marry an Latino women come to us rockmycity.info
honsusando 1 year ago
you forgot to mention about putting parenthesis around the: "hello %s" % self.name
TheMedic1231 1 year ago
@TheMedic1231 he's on a 2.x version of python. you're on a 3.x he doesn't need them
xkyle567x 1 year ago
@TheMedic1231 Actually, print ("hi") and print "hi" works same.
newman30000010 1 year ago
Bucky is a legend, best python tutorials on the web. i just hope they keep on comming
definty 1 year ago
This should be a TV show;
PROGRAMMING IN PLAIN ENGLISH!
xero907 1 year ago 81
@xero907 i don't think so
ThePokemonteacher 3 months ago
@ThePokemonteacher Erm... I don't learn Python anymore...
xero907 3 months ago
@mcfluffier
its a placeholder for a string (%s for string i think its %d for an integer) so u write %s in the text u want to print out and after the string u put % and then the name of the string u want to use in this case self.name
Rroundabout 1 year ago
I dont quite get it :(
boeing747200lr 1 year ago
i understand everything but the "%s" what does it mean
mcfluffier 1 year ago
@mcfluffier
just a placeholder or a mark for the print method that instead of the %s will stand the value of a variable...
dtschacher 1 year ago
these tutorials are amazing! please make more!
Coodous 1 year ago
Can't wait till I get to the pygame tutorials.
youknowwho52 1 year ago
I would like things to do for my self. Like an exercise to create something thats fun and works
jhasjkfhkjs 1 year ago
wayy tttooo fast
prisat32 1 year ago
fuck i dont get it ima watch it one hundred more times lolz
oo ok im getting there remeber first = classname
which makes first(same as classname).displayname(ur just displaing the name u put one the createname)
im i right?
jarocho151 1 year ago
fuck i dont get it ima watch it one hundred more times lolz
jarocho151 1 year ago
This has been flagged as spam show
thousands of real profiles real Russian women gettop5.info
kayla26762 1 year ago
I wish i knew you in person! best tuts on the web
entrevu 1 year ago
THINK GLOBALLY: ACT WITHIN LOCAL VARIABLE SCOPE
smithrmichael1997 1 year ago
thank you !
lassaad7 1 year ago
i didnt get this :|
2AWESOMETV 1 year ago
Self, self, self self self.
gcndavidmn 1 year ago
so that means in python you declare an variable at the time you use it:
'self.name = name'
so 'name' is the local variable of the function 'def createName(self,name):'
and the 'name' in 'self.name' is the variable for the whole class defined in a function by using it.
am i right?
ForAncelot 1 year ago
@ForAncelot no i think self.name is the variabe and name is the value
boys0fsummer1 1 year ago
Can you call the variables/attributes from other methods and use them in different methods of the class or do they work like local variables like in C++
izraqthedark 1 year ago
This has been flagged as spam show
thanks dude you Make OOP look so easy
irausi 1 year ago
thanks dude you Make OOP look so easy
irausi 1 year ago
Wow, u are amazing. I have been looking all over online trying to learn what classes meant and what they are used for. Your tuts 32 & 33 totally just made it click for me. You da man.
Cigotie 1 year ago
@Cigotie
me too dude. none of the resources i've been using have been clearer than bucky's series
lamchops9857 1 year ago
Wow! It all became super clear in the last 2 minutes! Your vids are nothing short of awesome; You could teach a ten year old to do this stuff!
fullofhate77 1 year ago
Create a class... Stopping power is a must!
j/k Nice tutorials Bucky :D
1wilco12 1 year ago
Well when iam trying to run this program in PyScripter Text Editor it is giving an
exceptions.
" TypeError: unbound method createName() must be called with Person instance as first argument (got str instance instead) "
here i have created class as Person but when i run in Python shell then no exceptions ?
Could you tell me Why this so?
bits071083 1 year ago
thanks man, i can use objects to create players for a simple python game. :D
tlarson91119 1 year ago
If you dont understand this you will NEEEEEEEEEEEEEEEEEEEEEEEVEER IN YOUR LIFE UNDERSTAND pihton lol
MrSaggat 1 year ago
thanks bucky, I had problems understanding this, but now I get it!
ultimatebas 1 year ago
I Love your tutorials. I was familiar with Python, but your tutorials were really helpful in clearing some of my doubts. I really appreciate your patience in making these tutorials. :)
leorahul16 1 year ago
alright, fine, i give up. you win.
gotta keep the pot heads weeded out i suppose
nextbest47 1 year ago
I Kind... Of Understand..
It is a little hard though so I'm gonna look at your next tutorials and hopefully it will clear my mind of worries :D
Zubb1987 1 year ago
if the creator of python just go a little bit further to avoid typing 'self' each time...
kl2217 1 year ago
thanks merci شكرا
faical117 1 year ago
thanks, self was bugging me :D
designernasser 1 year ago
This is making no sense to me, I did the exact same thing as you did, I even checked 7 times. and it says I have some error...
hudacheck 2 years ago
@hudacheck What version of Python are you using?
And what is the error?
SatanicVampireCorpse 1 year ago
Its Not Working For Me
Wheelz2020 2 years ago
Brilliant stuff Bucky! You make programming very easy and I am loving it.
93elara 2 years ago
thanks man great tut
DzTxProductionZ 2 years ago
YAY!!! i get it...
sekulr 2 years ago
thanks Bucky, I'm 17 years old and im teaching myself from home, so yea it's a pain in the ass but you made it a lot easier, thanks.
sekulr 2 years ago
@sekulr believe me its better to learn most programming languages from home than at school.
louismarcil 2 years ago
:P why do you think that? i kind of want a teacher, i have soooo many questions :P
sekulr 2 years ago
@sekulr most of your teachers wont know shit and will be reading by the book.
louismarcil 2 years ago
@louismarcil ehh ill find someone who does know :P
sekulr 2 years ago
Thanks man, I understand things much more easily coming from you than my college professors. I will most likely be watching many more of your tutorials.
leardas 2 years ago
Hi, Thank you for the classes..are very good..
I have a question for you, do you know if visual studio supports python? also if python nterfaces with API of windows with forms or similar ..I see that python is very easy to work compared with #c and #c++..thank you..PJ
wrodusa2006 2 years ago
Great videos. I needed to learn Python for a school science project, and this series got me up to snuff SUPER quickly. You are awesome. :)
TheGodzilla1955 2 years ago
but I thought objects needed to inherit the object class
supergenius1994 2 years ago
@supergenius1994
They are not required, but yes they can if you want to include all from others class. Still whatever you define for objects inside your class will overwrite values from inherritated class if they confront.
themewz 2 years ago
great man..u r doing it for free!!!!!!!!!!!!!!!
amarnathalapati 2 years ago 33
@amarnathalapati
you can go to his website and make a donation
loko95ftp 10 months ago 3
Thanks man that totally made sense. I Appreciate these videos.
GrandPictures 2 years ago 2
So anytime you create a method within a class, the self is a temporary substitute for an object.
suicidesymphony1 2 years ago
class warlock: def sep(self,sp): self.sp=sp def spellpower(self): return self.sp def haste(self): print "%s is here to save the fing day" %s self.sp
i cant figure out what im doing wrong with the self
zannza95 2 years ago
your last line needs to be:
print % is here to save the fing day" % self.sp
if you look at yours you put %s instead of %
lfroggyl 2 years ago
idk if i missed a tutorial, but whats the %s?
i know its a variable but which one?
im confused =|
pimpmobile999 2 years ago
it means you love vagina! %s
% stands for vagina.
s =hell yes....
ILoveDogsandScooters 2 years ago
@pimpmobile999 it is used to print out a string or other value from a variable, particularly in a printed message. Which means that it's not necessarily a variable, but a way for a result to be printed as part of a message.
TheGodzilla1955 2 years ago
does any one know how to pass numerical values between classes ???
emalkin71 2 years ago
This has been flagged as spam show
a little difficult at first but I picked it up towards the end.
phraudulence 2 years ago 5
Almost there... 10 more left!
Spazm6 2 years ago 3
nice
DaVietPride 2 years ago
I didn't get everything, but when you explained it at the end of the tutorial everything got more clear....
PS: KeeP tHe gOoD wOrK!
elteachel 2 years ago 46
Its strange that you can create an object variable inside a method.. I mean, you didn't define "name" as a variable in the class, but you can assign it in a method.. hmm, that's very weird, I wonder why they made it like that.
blenderuser 2 years ago
how come he passed only one parameter to the method first.createName() when the method needs 2 parameters (self and name)?
theLichKing1 2 years ago 2
self's the class "itself". if you create an object, the object actually takes over everything what is "self" in the class. that's why you don't have to pass 2 parameters...
BackRaw 2 years ago
very nice tutorial!
you know how to explain complicated stuff for the newbies to understand!
8deleted8 2 years ago
I like your style, you do a great job of walking us through the process of coding python. thanks great job.
hbwilly54 2 years ago 2
This is actually really helpful.
I will be posting my python projects on my blog :)
CodeJustin(.)com
chjustin69 2 years ago
good stuff
simonwessel 2 years ago
how many of these are u gunna make lol :)
homeboy1004 2 years ago 15
800
thenewboston 2 years ago 162
you going to put these python tuts in a 'youtube playlist' anytime soon?
darxalot 2 years ago
it will help them rank higher on youtube search index btw.
darxalot 2 years ago
whao are you really well thats kool keep up the good work
homeboy1004 2 years ago
awesome keep'em coming. Do some socket programming!
MasterMind300 2 years ago
@thenewboston bad ass that awesome! can't wait. thanks for the great tutorials man.
imurbanninja 1 year ago
@thenewboston aww, it's not over 9000.
karmen42531 1 year ago
@thenewboston actually, you have now 950 tutorials! Long Live Bucky (we want more)!
elementoxygen 1 year ago
@homeboy1004 over 9000!
tinimakoo 1 year ago
I WANT TO KNOW HOW TO GAME DEVELOP :D
Metalheadplus1 2 years ago
Pygame,....and follow the links!....and stay away from MS!.
22dedeurwaerder 2 years ago 3
LOL :D
metalgearsolid444 2 years ago
This comment has received too many negative votes show
fisrt one woot
metalgearsolid444 2 years ago
DAMMIT I'm so jealous hahahahaha ur stupid
marquesbrownlee 2 years ago 3
who cares
NathansGaming 2 years ago 2
you care... you comment
metalgearsolid444 2 years ago
Yea totally im just pointing out that your stupid
or do i really care
maybe the jealously burns up in my soul and wants to kill the next think i see yea i think i care
NathansGaming 2 years ago