Hack Forums
[Python] Classes and objects - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] Classes and objects (/showthread.php?tid=6046437)



Classes and objects - Sympth - Feb 3, 2020

So, I am comfortable with my python as of rn. So I have taken to learn about classes and I cant seem to understand it I have watched a few video videos and raid some documentations online, and a new book I recently picked up "Black Hat Python" it uses classes a fair bit in it but I am struggling as I can't use classes very well. Has anyone got a certain way they would suggest for me to learn about them? Or does someone have a good explanation? I kinda get it but then I don't its weird.


RE: Classes and objects - Riԁdle - Feb 3, 2020

(Feb 3, 2020 01:51 PM)Sympth Wrote:  So, I am comfortable with my python as of rn. So I have taken to learn about classes and I cant seem to understand it I have watched a few video videos and raid some documentations online, and a new book I recently picked up "Black Hat Python" it uses classes a fair bit in it but I am struggling as I can't use classes very well. Has anyone got a certain way they would suggest for me to learn about them? Or does someone have a good explanation? I kinda get it but then I don't its weird.

What exactly are you having trouble comprehending about classes? What they're used for? How create them syntactically?


RE: Classes and objects - Charger - Feb 3, 2020

Checkout this SO answer. It’s a good explain of classes with a super simple example.

https://codereview.stackexchange.com/a/145764


RE: Classes and objects - SIM-4073027 - Feb 3, 2020

w3s has a pretty good classes guide

https://www.w3schools.com/Python/python_classes.asp


RE: Classes and objects - Sympth - Feb 3, 2020

(Feb 3, 2020 01:55 PM)Riԁdle Wrote:  What exactly are you having trouble comprehending about classes? What they're used for? How create them syntactically?

Just classes in general like, making one and doing a certain part of code when its called. as well as then giving it like a user's input if that makes sense? aswell as what they could be used for. As of right now I mainly use functions when splitting up my code.

(Feb 3, 2020 02:26 PM)Proxy Wrote:  w3s has a pretty good classes guide

https://www.w3schools.com/Python/python_classes.asp

Thanks, I will take a look at this now!

(Feb 3, 2020 01:56 PM)Charger Wrote:  Checkout this SO answer. It’s a good explain of classes with a super simple example.

https://codereview.stackexchange.com/a/145764

Thanks, I will take a look at this now!


RE: Classes and objects - Money- - Feb 4, 2020

If you want a raw way of learning what's Classes and Objects.
Try and learn Java , you will get used to the concept of OOP.

Its basically good for code reusing and maintainability purposes.
Its useful trust me, if you want to develop a full program. This concept is really important.


RE: Classes and objects - Nikix - Feb 4, 2020

Hi, you are not alone, classes are sometimes more abstract thing, but they are really useful. I had same problem as you to understand them. I have small list of stackoverflow questions about classes in python. It helped a lot.

https://stackoverflow.com/questions/40929959/why-use-python-classes-over-modules-with-functions
https://stackoverflow.com/questions/36640673/why-should-i-use-classes-in-python
https://stackoverflow.com/questions/18202818/classes-vs-functions
https://stackoverflow.com/questions/33072570/when-should-i-be-using-classes-in-python