Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
adsfewfad asdfewfcxz
252 Pointswhats object oriented python
what is it
3 Answers
Daniel Santos
34,969 PointsHi Boaming!
I think its better to first understand what is Object-Oriented Programming because if you understand what that is, that will allow you to jump from multiples Object Oriented Programming languages.
I am not trying to give you a lecture, but I can tell you from the beginning that this is a very large topic and takes time to assimilate. From now on I will refer to Object-Oriented Programing as OOP.
The idea of OOP is pretty much to model physical objects like spaceship, books, animals, etc. In overall anything that you can imagine as a physical object, you can model it using OOP. OOP can describe properties of an object, and its behavior. For example, let make a little model of a car. A car has properties like wheels, engine, transmission, and a lot of stuffs that I am omitting, of course. But a car isn't just a set of items, properties. A car can turn on, move, break, clean the windshield, etc. That will be a behavior of a car.
But why do we want to do this? Well, if you think about it, we, the users, interact with object in our everyday life. So if we, some how, make computers model object from our world, then we can describe them better.
It sounds like a lot of work? Yes, but that's why OOP exists. OOP allows us as programmers to model object in a reusable way and makes development time less frustrating.
Now to answer your question, OOP in Python is just the way to implement object in the Python language. As you get involve into OOP, you will notice that the concept that your learn about OOP in Python can also be applied in Java or C++. Of course, its a different syntax, but that IDEA its the same. Remember a car is a car. If describing it using Python, Java or C++, it will always be a car.
Lastly, there are tools that you will learn about like Class, Method, Instance Variable, Inheritance, Composition, Polymorphism, and a few more that will allow you to model object in a very efficient way.
If you have any question please comment. And for further reading check the link below.
https://docs.oracle.com/javase/tutorial/java/concepts/ http://www.webopedia.com/TERM/O/object_oriented_programming_OOP.html
Hope this help, -Dan
Chris Freeman
Treehouse Moderator 68,468 PointsIn the classic sense of the definition, in object oriented Python, in addition to functions, you have classes. Each instantiated class object has attributes (local variables) and methods (local functions) bound to the class or an instance of the class. These methods provide access to the attributes and provide functionality to interact with the class instance.
That said, in reality, all Python is object oriented because everything in Python is an object with attributes. So OO Python is about learning about using classes.
adsfewfad asdfewfcxz
252 Pointsso python and java are pretty similar? i was expecting python to be like javascript because python is web based but it looks like python is more . also you have a ton of python points. did treehouse help you out alot? because right now im doing javascript and python on codecademy.
Chris Freeman
Treehouse Moderator 68,468 PointsYes, it's crazy how many Python points I have. I knew python before starting on treehouse. The Treehouse Python courses were a great refresher on many topics and did help me go deeper on new packages and some coding techniques. I like using the tougher forum coding questions to personally challenge my skills. I haven't done more than the basics on Code Academy, so I can't compare their treatment of intermediate and advanced topics to Treehouse.
I would not call java and python similar. Java is a strongly typed language and uses braces "{ }" for marking code blocks and semi-colons for end-of-line markers where Python uses indentation and no explicit typing.
While Python does have powerful web packages such as Django and Flask and many others, it is a great general purpose language with package support for data analysis (pandas), natural language processing (nltk), numeric processing (numpy), and over 71,000 other packages.
Python is my first choice when I need to quickly create a program.
adsfewfad asdfewfcxz
252 PointsWell just like java, python has functions, variables, and now i know theres even OOP python. I've done java in the past and most of the things so far look pretty similar. Just the biggest difference is no semicolons and the braces as you said.
In terms of python jobs, what are some other skills that would be beneficial? alot of the job posts i see revolve around python with a framework with additional knowledge on html/css/js/database stuff. i hope that with treehouse i can land a new job as a python developer but not sure what are complementary skills that i have to know.
from your points, it looks like you have done the things i stated above. i dont think its possible to just use python by itself but rather needs something to go with it unless im mistaken
Chris Freeman
Treehouse Moderator 68,468 PointsGetting a job programming in Python comes down to package knowledge. Each job or project will rely on certain Python packages as part of its design. The hiring managers will look for experience with these packages. It is very job specific. As an extreme example, one contract job i had relied on a very specific open-source python package VOLTTRON (on GitHub) to develop smart-grid nodes controlling electric power distribution. Many packages such as this are not worth learn the package unless you are applying for a job with that requirement.
In terms of skills, once you have a better master of the language, start reviewing job descriptions to see what packages they are using. Create portfolio projects using these packages to demonstrate mastery. If you already have portfolio projects in languages other than Python, they also help to show knowledge of programming in general.
There are very few programming jobs that a single-language specific. Most jobs need a broader experienced programmer that can wear many hats due to company head-count limitations. While companies will want skills beyond Python, they don't always expect mastery of all aspects of HTML/CSS/JS/SQL as mastery of each of these is a large task. A working knowledge with basic understanding of these other aspects is usually enough for junior developer positions.
Treehouse Career Program can help guide you to a Python job. There is Treehouse staff dedicated to help with the Career Program.
Best of luck in your future Python career!
adsfewfad asdfewfcxz
252 Pointsthanks chris. do we learn about packages in the python track? if it's that important, then i sure hope its taught. all im learning right now is console things and im not terribly sure if this is even important. and that link unfortunately says i dont have permission to view that page
Chris Freeman
Treehouse Moderator 68,468 PointsThe layout may have changed. I have a "Career Program" button in the left margin menu (fluted circle with checkmark in side) below the Workspaces icon. Perhaps it gets enabled after starting into the Program. Try Career Resources link also found at bottom of page (briefcase icon).
Additional Python packages are introduced as you make progress through the courses. Treehouse can only scratch the surface of the vast library of packages. So additional self-learning will be necessary. Many packages have documentation and tutorials to help your learn the details.
You might be interested in Talk Python on Twitter and it's podcasts for ideas on packages you might want to explore.
Nathan Tallack
22,164 PointsFrom the horse's mouth. ;)
https://docs.python.org/3.5/tutorial/classes.html
Compared with other programming languages, Python’s class mechanism adds classes with a minimum of new syntax and semantics. It is a mixture of the class mechanisms found in C++ and Modula-3. Python classes provide all the standard features of Object Oriented Programming: the class inheritance mechanism allows multiple base classes, a derived class can override any methods of its base class or classes, and a method can call the method of a base class with the same name. Objects can contain arbitrary amounts and kinds of data. As is true for modules, classes partake of the dynamic nature of Python: they are created at runtime, and can be modified further after creation.
And of course, the right way to learn it is right here on TT. ;)
adsfewfad asdfewfcxz
252 Pointshehe thanks. so python is like java? i have had java experience in the past
Gerald Wells
12,763 PointsGerald Wells
12,763 PointsFrom what I understand at this point it just means that your code is modular, separated into different files so you can call multiple classes and models over and over again through out the writing of your program and also other projects you will do in the future.