Python everything is Object

Source: Internet
Author: User

Python is very thorough in object-oriented, and even though the procedural code style, Python is object-oriented when it works. Everything is object.

Difference

In the object-oriented concept, Python and very engineering object-oriented languages (C + +, Java, C #) have huge differences, these languages, in order to explain their principles, often sacrificed a large kill device-----memory model. Run the process with a simple, very over-weighed description principle. (Of course, I did not say this is not good, this is more straightforward, simple.) Python speaks to the deepest, it will tell you a lot of objects of the story. Unless you want to drill down into the interpreter, if you go into the interpreter, it's C + +, Java, C # things. So let's talk a very deep and simple example of memory objects. 5 is a number, but also an object, all objects are managed by the Python environment, run the python command

>>> ID (5)19867920

You can see the 5 address in the Python environment. It is a memory object of Python.

The most obvious difference is where we are often overlooked. The type of Python is also an object (using type () to try to get Int,long,type), while Int,long,str is the type, which is the metadata. Is the language can not explain, and directly apply the hardware of some ideas.

Well, some python in some of the things inside the Nook, c++11 seems to be a new language (good old, today just understand, auto,Decltype and for the introduction, is to let me now feel the most comfortable place AH) has not begun to use c++11 it. It's a lot different than the previous version. I'm so behind.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.