Python Classes and Objects || Python Tutorial || Learn Python Programming
ฝัง
- เผยแพร่เมื่อ 27 ส.ค. 2024
- 𝙎𝙩𝙖𝙮 𝙞𝙣 𝙩𝙝𝙚 𝙡𝙤𝙤𝙥 𝙄𝙉𝙁𝙄𝙉𝙄𝙏𝙀𝙇𝙔: snu.socratica.... Classes are a fundamental part of modern programming languages. Python makes it easy to make a class and use it to create objects. Today you will learn the essentials of programming with classes: how to initialize them, write methods, store fields, and more.
To learn Python, start our Python Playlist HERE:
bit.ly/PythonHe...
Subscribe to Socratica: bit.ly/1ixuu9W
♦♦♦♦♦♦♦♦♦♦
We recommend:
Python Cookbook, Third edition from O’Reilly
amzn.to/2sCNYlZ
The Mythical Man Month - Essays on Software Engineering & Project Management
amzn.to/2tYdNeP
Shop Amazon Used Textbooks - Save up to 90%
amzn.to/2pllk4B
♦♦♦♦♦♦♦♦♦♦
Ways to support our channel:
► Join our Patreon : / socratica
► Make a one-time PayPal donation: www.paypal.me/...
► We also accept Bitcoin @ 1EttYyGwJmpy9bLY2UcmEqMJuBfaZ1HdG9
Thank you!
♦♦♦♦♦♦♦♦♦♦
Connect with us!
Facebook: / socraticastudios
Instagram: / socraticastudios
Twitter: / socratica
♦♦♦♦♦♦♦♦♦♦
Python instructor: Ulka Simone Mohanty (@ulkam on Twitter)
Written & Produced by Michael Harrison (@mlh496 on Twitter)
FX by Andriy Kostyuk
♦♦♦♦♦♦♦♦♦♦
Wear a Socratica Python shirt for good luck coding: shop.socratica.com/products/python-by-socratica
Watching these videos make me feel like, I'm an FBI agent and my supervisor is directing to me a deadly mission. Really enjoy the videos!
Exactly! I love it
feels like being hitman
Your phone will destroy itself after the message. Good luck agent Py.
this video make MI movies look like sesame street.
Gotta overthrow this modern "class"-system
It's official! The Socratica Python Kickstarter was a success! Thank you to all of our supporters. Because of you, many more Python videos coming soon!! 💜🦉
That's some great news!
pls elaborate videos, need more content :-)
But I don't know why every video have too much time gap. If some one want to complete the whole course , how can he? Because your content is absolutely amazing . All you need to do is to upload all video at same time. Thank You so much.
PRAISE JESUS THANK U
Thanks !!! for this vídeos
Avoiding uncomfortable stares from peers is my priority in life.
Absolutely😂😂😂
However, if my peers looked like the narrator then I wouldn't mind! :)
hahahahaahahah
hahahahaha
I think I will start a new trend called FYP = F*** Your Peer's I might not want them to understand my top secret code/program/App lol
This is how knowledge should be spread.
It feels professional, futuristic, fun and really soothing.
Well structured and easy to understand. Great video :)
Funny too :)
Amazing content best in the world
WHATS AN OBJECT
Never thought I could be so attracted to an AI.. she's so smart ( :
@@vedatporikli7417 an instance of a class - 1:33 and 3:15
I love these Socratica videos. I'm so buried in long winded Python text books I don't even know which way is up or down. Socratica can take a topic like "Classes and Objects" and boil it down into a 10 minute video. Socratica is a great booster shot.
you can't forever rely on youtube videos to learn useful and valuable skills
@@luxraider5384 that's why you learn through multiple sources, which he was. Maybe you're better at taking in written information but heaps of people aren't which is where these videos help
yeah true, but you cannot overlook the importance of books too. Maybe the videos help you to understand the books in depth. But it's is the books which have a lot of information than any of videos. The videos are just the tip of the iceberg, even assuming a specific topic.
@@luxraider5384 sure you can.
Your videos are truly in a class by themselves. The info is clearly and unambiguously presented.
As a slowly aging C designer, these are one of the most fun Python tutorials I've come across so far. The puns, the dry humor and the obvious love for science and SF by whoever the scenario writers are is just a bonus. Nice work!
We're so glad you're enjoying them! We have so much fun making our videos. 💜🦉
what does dry humour and SF mean?
SF => Science Fiction @@yash1152
"I finally saw The Matrix today. It was the best documentary I've ever seen." Dying right now.
LuL
Your lessons are amazing. You are helping many people especially aspiring developers from Africa. Cheers from Kenya
@@tomwilliam7299 ill trade you my citizenship if you have a good one haha
😂😂😂
Welcome to Socratica! You can see our entire Python Playlist here: bit.ly/PythonSocratica
Subscribe to see all our new videos! bit.ly/SocraticaSubscribe
If I could date you, I would be happy.
@@Mantikone what kind of comment is this oof
I love classes with you, would you like to have a diner together ?
superb practice make human 😀
the only dam video on youtube that actually explains classes and instances, thank u
Kevin Fang after seeing the video I realized that all my damn life has been a lie.
chutiye aur bhi kai video hai.
Exactly
Corey Schafer
... ppl cant even use ytb nowadays
True.
Dave Bowman and Frank Poole were astonauts on Discovery One in the movie Space Odyssey.
Thanks for The so called Easter Eggs
Oh, thanks... Those two names sounded so familiar... lol
Arthur c Clarke is a science fiction writer and visionary. I'm a nobody, hi.
I was looking for this exact comment, thank you Rob
Another great documentary
We're glad you've found us! You can subscribe to Socratica here: bit.ly/SocraticaSubscribe
To help us make videos faster, you can become our Patron! www.patreon.com/socratica
I have a classes with an instance full of love for u 😍💕
Excellent as always. Thank you for making these great videos. They are even more helpful than you might think.
They are helpful in a new way.
I've watched a lot of programming videos and this is by far the highest quality series I've found. Thanks a lot and keep up the good work!
This is the new world way of explaining! I love it!! You would think that you are more distracted by the method of teaching, but it consumes your attention and really works! Thanks so much for this creativity and implementation of what we all have seen in films, this time it applies to all of us
Thank you very much! I've seen many tutorials about classes in Python and this one is one of the most helpful for me. Also I like your humor :) Can't wait for new Python lessons.
I've been butting my head against the wall on classes for a while now, I have watched at least a dozen videos, read the python standard library. I've been able to "make it work" but it wasn't until i watched this and saw it stripped down to nothing but a "pass" command that i started to get it. I stayed up for 3 hours last night experimenting, and its thanks to you. You are a wonderful teacher.
oh my god sometimes I just love youtube, I feel blessed to be able to see so much effort and creativity packed into one video full of knowledge . Thank you, thank you, thank you :D
These videos are very helpful. They are informative but not boring, attention grabbing but not filled with fluff, and they hold just enough clever humor to spice up the presentation (0:40 "I finally saw the Matrix today. It was the best documentary I've ever seen." or the DocString for your user class 7:19 - """A member of FriendFace. For now we are only storing their name and birthday. But soon we will store an uncomfortable amount of user information""" - absolutely priceless!!!) Subscribed!
"Classes are a fundamental tool in any respectable programming language."
Cough,cough cough
+Saeed Baig haha I what you did there. ;-)
Hence, C++ exists.
I don't it.
Python jealou
Saeed Baig
In OOP not all programming languages ...
That‘s a big no no ...huge mistake and wrong info
I love it when correct naming conventions are encouraged 🤩!
"Even if you are writing code only for yourself, it is a good habit to write a doc string. You may have to use a Class years after you first wrote it. A few seconds of typing is worth hours of sanity down the line."
Absolutely brilliant way of emphasizing how important comments and doc strings are in code. Never assume you will remember what you wrote or why you wrote it.
Explained most important things in 10 mins, which what others can't do in 1 hour
Most of these 'theatrical' instructional videos are just distracting, but you folks have a really good 'formula'. Keep up the good work.
I just randomly found this channel, and this is the coolest, most creative way of teaching I have ever seen. It makes me feel like I am some kind of commander, and I am being briefed an important message by an AI named Socratica. Thank you, Socratica, for making these videos.
Welcome aboard, Commander! Glad you've joined us. 💜🦉
The only video I have ever found that explains classes so that I can understand. Really love these videos thank you
the first TH-cam video I ever saw with "EXCELLENCE" in way of teaching 😍😍😍 mam, thank you 😋
How did I just stumble on this. What a fantastic series! Thank you so much for the work you've clearly put into this!
We're halfway there. We still need your help! Support Socratica Python Kickstarter: bit.ly/PythonKickstarter
Support what you love! Socratica has a Kickstarter to make more Python: bit.ly/PythonKickstarter
Nice 2001: A Space Odessy references! "It's full of stars!" I'm learning to code and these videos are great. Thank you for making these!
especially amusing since her voice is very "robotic", like HAL9000s :P
@@MicroageHD Should we trust her.
You have excellent creativity skills....Initially i was shocked to know that your channel has only 96k followers which i feel is low....You have know idea how many people who want to learn python would be gratefull after finding your channel...Hats off to your skills...Your video reminded me of assassins creed video...I think you should try something in mainstream game development if u havent already...anyways best of luck and thank you
"only 96k" -.- really
Classes n instances were explained well..every coding channel need to go back to basics
Not even a minute into the video and I'm already sold. Great work!
" lets create a second user. We will call this second user, creatively, user2 " :P
I couldn't ever guess that name. Socratica is best in creativity....
Looove the video style and explanation!
My doubt got cleared in 1.5 mins.
I've checked in every TH-cam channel that I rely on to study. I've only subscribed to channels that can clarify my confusions. And unfortunately no other channel cleared what I wanted, because they didn't even mention it. But you did.
You're one refined channel.
ONE OF THE BEST PYTHON TUTORIAL OUT THERE...
Excellent channel and video. It's a bit cringy, yet insightful. There's some humour to it, yet the lady looks completely serious. The effects and style of the video seem overstreched, yet the content is very easy to understand. I don't know how you came up with this idea, but you nailed it, Socratica.
I love the production value and dramatic tones of this and I am sure your other videos. Your content is great and I will be sure to share. Your hardwork is very appreciated. Thank you
I have learnt about class before but I have to watch this video because of your classic approach. Thank you very much.
Hi Socratica! Hope you are keeping safe! Really wish to see some new videos from you during these quarantine times!
I LOVE you Socratica team! The fact this channel is what it is makes me love humans (and machines) even more :D
Can you please make a video on super() and class inheritance?
THANK YOU
I was just started to learn Python and this comes in handy! Thank you:)
are you steel learning?
coolest, darkest, most robotic yet human friendly programming tutorials on the internet
I like the vibes of this video. It gave me the feeling of learning my rookie lessons with a commander in the Python War I.
Very nice speaking voice, tone, screen automated visuals, style, and speed of speaking. "Voice" is not the only criteria to me, but it is somewhat "huge". I like the way that the words are spoken fast enough, but they are not spoken "too fast", as I have seen some do, and while people may "know their stuff", programming-wise, it can be yet another thing to have the gift of teaching and presentation, as well as the blessing of tone fluctuations and very clear, crisp English accentuation, too boot. Watching this particular video (as well as others) and following along is made to be almost sort of 'fun', i.e. toning down the (mild) frustration, or self-impatience of learning something new while turning up the joy of it.
The thoughtful and careful clarifications, the method, the tempo, and video technology that are incorporated, result in great synergy. In other words! "Great job, be encouraged, and keep up the good work!". I prefer this video over most any other I remember seeing (of all teaching presentation videos, or perhaps I should say 'this series', so that it does not sound like I am preferring this video above all of your other videos. This is a good "instance", but I like the overall "class", that I see in all of them. :-) (pun intended)
Definitely agree with you. She's very clear even to a non native English speaker like me, because everything is just perfect. Plus, the serious/semi-robotic style puncutated by occasional bursts of humour is very enjoyable
Came to learn Python! Fell in Love!!
I finally understood classes...
This channel will never be old
1) Every value in Python is an object.
2) Every object is an instance of a class.
3) Every name in Python is a variable. This includes function names and class names. Function definitions and class definitions are just forms of assignment statement.
4) Since functions and classes are themselves just values you can put in a variable, that makes them objects, which must themselves be instances of classes.
(To be continued.)
"And we will do so , in a CLASSy way."
O no
Best youtube channel for sure!
From all of the rest of python videos Socratica does a really good Job explaining Python.
I wish my Python programming classes were this interesting and engaging.
Well done.
"I WANT TO GATHER AS MUCH DATA AS POSSIBLE FROM USERS " LMAO THAT KILLED ME
when I reach 10million dollars my startup that time I am invest 1 million. dollar for your work ...I'm sure that day come in future ..i love your work and passion helping and sharing knowledge ....
Thank you so much for your kind message! We are rooting for your success!! :)
Hire me while you are at it please.
can i help?
you can donate them on patreion a smaller amount of money
How goes your progress?
Finally someone that teach without derailing and non necessary nonsense. Thank you.
Truly in a class by itself, I just can't stop watching these videos... I've learnt so much from them! Thank you!
Damn, you're entertaining and educational all at the same time. Thanks a lot for the Videos, I was about stuck to C++, now just Python all the way from [Se] to [Web].
Ok am I the only one how come from C++, JAVA, C#, etc , and was like " but, you didn't define first_name and last_name in your class!🤨 "
no private or public either, I feel uncomfortable!
I'm glad I'm not the only one!
it`s super strange, i don`t liked
That is indeed a weird and not very common thing to do in Python. You normally define all your instance variables in the __init__ function. But yes, you can do it in Python....
I've been working with C++ for years and it wasn't the same for me; when I first seen that I was like wow; that's pretty cool you can add a member variable to a class after the class has been created. I thought that was pretty cool. However I did watch a couple of other videos about Python and the core features of its language and what I got from them was that just about everything in Python in a sense is a run time object. Under the hood there are 4 basic data types, int, float and string not counting Boolean such as True and False. Once you create an instance of these at the local or global level you can not change them like you can in other languages. So if you have a variable as such: x = 10 in the global space x will always = 10 and you can not change it, this isn't the same for members. But basically everything you create or declare in Python under the hood is in a general sense a shared pointer object. Everything is created on the heap, there is no stack although you can create a stack object or structure with classes but Python doesn't have any notion of Stack or Variable Storage Specifier such as in C++ with automatic, static etc. I've only been learning Python now for about the past week and I'm catching on very fast. I'm starting to really like the language. The underlying nature of Python and being that it is a Scripting Language is that it is also a Dynamic Language. Everything you create in Python you can use Python's built-ins and some of their libraries to query the underlying pointer or memory address as well as the byte code of any and all Python objects.
I feel like learning a lot from you than my professors! This futuristic atmosphere while explaining things classes and objects felt like I was learning things quicker than expected. Great work!
Finally an actual educated person on you tube. thank you for this video and all the rest you may do.
Socratica:"Classes are fondamntal tools for any respectable programming language"
C: Am I a joke to you?
All Functional, Imperative, and Logical languages: Are we a joke to you?
Yep
She said _respectable_ . 😝
Great videos, very helpful. Could you please scroll the code up a little bit when it gets to the end of the screen in future videos. I pause the videos to code along, and the TH-cam UI obstructs the view of the code at the bottom when paused.
Thank you so much for letting us know! We see what you mean. We will try to avoid this in the future! As a workaround, looks like the TH-cam framing doesn't interfere with the video if you go into fullscreen mode. Oh, TH-cam.
Wow, this is fantastic and beats any python learning on youtube. I love this stuff.
I have been teaching myself python for about a month(it is also my first programming language so I had to start with the very basics). A week ago I started classes and two days ago I gave up. I just didn't get what they ARE. Luckily this video was suggested to me here on TH-cam and I feel ready to give it another shot. Thank you.
So after you create a class, you can add any number of variables to an instance of that class? Coming from Java, that just seems weird.
coming from c++, that just seems weird.
coming from no language, makes sense to me.
Coming from C, it's something completely new
python is a dynamic language. you also don't have to declare variables before using them and python does a lot of data coercion for you too
coming from mars , maybe i should go back to mars
Data's better half ;-)
"In fact, most other programming languages are quite jealous of Python for its elegance and simplicity." Hahaha! That knocked my socks off from the get-go!
This is the best introduction to classes so far. The other videos are slightly more advanced and thus more difficult to follow. Thanks :)
OMG, how I love...
PIE-THON!
. 2:43 , 2:47 , 3:13...
. How was a space inserted automatically between the first and last name??!
It's because a comma is used here for concatenation. if it were a "+" instead of "," you would have to add space.
It sounds so cool when you say "RUN"
the authority and efficiency of our teacher is good.
Where is the next video then? 7:50
I keep thinking of me watching a game live instead of a python tutorial lol
This is perhaps what being taught by a Vulcan would be like. But it's very clear and concise - thanks!
These are the best, and easiest videos to learn python from on youtube.
Why isn't this channel growing much??
We need your help to grow!! The best thing you could do would be to share our videos on Twitter, Reddit, Facebook, etc. so more people will learn about us.
We really appreciate it. We want to stay in business to make more of these videos for you! :)
Thank you so much for your help! It really makes a difference! :)
Xitiz Shrestha advertisement speaks in this 21st century .
One of the main reasons comes to be audience. Socratica's videos are excellent, but there are far less programmers than there are people actually on youtube. Though the field is always growing and getting people engaged in what most view as a very dry subject into showing how it empowers the end user, and how useful programming is very important.
Ken M so programmers aren't people?)
Aren't "fields" really called "attributes"? I've searched the web for like 30 mins and that's pretty much the conclusion I've drawn
Yes they are the same. Attributes are variables in a method, this is also what a field is.
An attribute can be a field or a method (a variable or function defined in the class, respectively). Standard terminology varies depending on the language, but that's what I learned with Java.
Gallade6349 see previous comment
iLoveTurtlesHaha But you aren't wrong: usually "attribute" refers to a field. Rarely will a method be referred to as an attribute. I think the user.age() is a good example of a method which could be considered an attribute, especially since it returns a value derived from fields defined in the class. Whereas a method that deletes a field or changes it's value, for example, would be unlikely to be called an attribute of a class.
I just bumped into a TH-cam channel that can truly help an Earthling like me with level 0 programming ability. Well, it seems that I found a classy way of learning Python.
I'm so glad I've found you
"...because reasons" very dry humor over here.
for reassons 😂😂
Personally, I have recently started a job role where I needed to learn lots of SQL and Python and I have had only previous minimal exposure to both. I've been picking it up very quickly, and already written a few of my own scripts/improved previously written scripts thanks to Socratica. The trick is just to keep writing code and solidifying the topics discussed in these videos. Even if something I did before was a small manual task, I'm finding ways to automate those tasks using Python and it's really not been that difficult to wrap my head around. It's also just a lot of fun and python is so widely supported for just about anything you'd want to write code for. The opportunities are endless!
I love the way they approach these more advanced topics without going too far into the weeds on technicalities. Knowing the ins and outs of how python functionally works and interacts at a high level is very important for more advanced scripts, but this is just essential information and exactly what you need to start coding - optimizing code and knowing all the little tricks to save lines in your code comes after and I highly suggest anyone unsure of where to start to literally just start with ANYTHING.
Would love to see a Socratica video on Python Async and Await (unless I've just missed it).
Keep up the awesome videos, you all are great!
The presentation is lit.. Enjoyed the way it was laid out... Its fun
ASMR + TUTORIAL = this video.
Exactly
Although the lessons are good, I get scared by her presentation, as if I might be inducted to a learn programming for evil intentions.
LMAO, I think it's cool AF and so do most people watching (as you can see from the comments) :P
I think the evil intention is you can tell others: "Learn to code" :)
I am just a beginner and this video helped me more than my teacher. Thanks!
Articulation, cadence, tone, presentation. Excellent. Very C&C sounding :)
Thank you, I have understood, that "self" is an attribute for the variable of the class object, and that the same variable-
name can be used, without self, if you are not interested to the "class". Therefore how and why to use "self". Thanks again.
Fun animation timed with what's said. Clear explanations and she doesn't do a too simple or complex attempt at explaining. Very good tutorial quality
After seeing a lot of videos on python, objects n classes I wasn’t getting all my answers.. every video wasn’t satiating my doubts . Now man after watching this I really feel this is it.. ultimate vdo, most perfect n crystal clear explanation.No extra talk. So happy. It’s an art of teaching.
Thank you so much for your kind review! We're so glad you are finding our videos helpful. 💜🦉
Direct, clear, and to the point. Kept my attention throughout the whole video. Other videos ramble way too much or try to make it funny, etc.
That's BRILLIANT content, thank you very much indeed !
These videos are the best tutorials on youtube.
youre amazing, clear, concise, comprehensive
Great tutorial, plain and straight