Everything is an object, everything is a pointer, everything is something (Python's programming philosophy)

Source: Internet
Author: User

The 1000-page Python learning manual was finally chewed out. Never understand a programming language from a deeper level, learning C is so, and so is learning java. Always feel that these languages are used. Do not care why it is created.

These days seriously systematic learning of the Python language, and the author of the python is a bit grok.

How I feel:

It's not too much to say that Python originated from C. Moreover, everywhere is the pointer, everywhere is the object. Have to admire the author's creativity, he has been the C language of the hands of the whole burn. If you don't have to touch it, the memory crash is just. It's not conceivable that Python's authors have made the C-language pointer all this way, and even developed it into a programming language that is integrated into a variety of Linux systems.

Now it is not possible to understand the Python language with the C-language idea. Online a lot of C # and Python comparison, but I would say that the two language design ideas from the most core, the bottom of the solution is not the same way. C # is more like Java. And Python is more like C.

See, a =5 is a very common assignment in C, and we usually call this statement an assignment, but in Python it's wrong to understand.

We looked at their memory address, found that the address is the same, the original Python as a statement of the object instantiation. is to instantiate an integer object as a variable, and if it is written in C, it should be written as:

A= New 5 ()

It is not surprising that a class, or object, cannot be named by numbers, but as an object instantiation, or instantiation of a class, the problem is well understood.

can be a = 5, the page can a= ' AAA ' and so on. And this time, the original A's address was recycled. The A here again points to the address of the string.

To be blunt, instead of defining a variable, a pointer is defined:

C: *a = 5

In short: Python considers all data, everything as objects, and in Python, there are no variables, only pointers, variables, and pointer variables.

The La La la la .....

Everything is an object, everything is a pointer, everything is something (Python's programming philosophy)

Related Article

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.