Home  >  Article  >  Backend Development  >  A brief discussion on the basic features of PHP and Python_PHP Tutorial

A brief discussion on the basic features of PHP and Python_PHP Tutorial

WBOY
WBOYOriginal
2016-07-20 10:57:58909browse

We all know that PHP is an HTML embedded language, and Python is an object-oriented, literal computer programming language and also an A powerful and complete general-purpose language.

The following will provide some descriptions of the respective features of PHP and Python, which may also be helpful to you in choosing the appropriate language for your project.

Look at PHP and Python: Problems with PHP

The reason why I gave up PHP was first of all the language. PHP is actually not a language, but a huge plug-in structure that exposes low-level libraries in a high-level form. The languages ​​used by most developers are actually wrappers for C functions (curl, mysql, gd, etc.), and usually their libraries are very simple. Thus this leads to inconsistency in PHP's API.

The second problem with the PHP language is language management. The PHP language was actually designed by committee, and no one set any consensus standards. PEAR has its own standards, PHP has its own standards, which results in SPL classes being more Java-style, while PEAR is completely different.

In the 11 years since I have been engaged in PHP development, I have met many expert developers in the PHP field, and they also have many opinions on PHP. In addition to the committee issues and standards confusion mentioned above, because PHP is used so widely, backward incompatibility causes a lot of damage to the code.

Another point to mention is that PHP lacks many features of modern languages. Now let’s talk about Python:

PHP and Python: The beauty of Python

The way the Python language was created is almost the exact opposite of that of PHP. First of all, Python is led by Benevolent Dictator and Guido van Rossum, and the development of the language is led by a single person, so its development, management, and long-term operations will maintain good continuity.

Guido and Python's core developers create standards through PEP, and demonstrate how standards are created through public interfaces. Moreover, if the language features Guido thinks of are not good enough, they will not appear in the language layer (for example, there is no ++ operator, and there is no assignment in the comparison operator).

The continuity feature also extends to the entire Python community, so it is difficult for you to find completely different Python in different projects.

One of my favorite features of Python is its clarity. When I open a file in Python, I will clearly know what kind of code is inside. Thinking of the many times I have been frustrated by this aspect of PHP, I think this feature is very useful.

In short, Python’s system-level features are very good.

Another great feature of Python is its straightforwardness. Need a namespace (namespace)? The name of the file is the namespace; need a module? Just use an __init__.py file instead; need a rename function? Just new_func = old_func.

I hope that this article’s introduction to PHP and Python can give everyone a deeper understanding.


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445744.htmlTechArticleWe all know that PHP is an HTML embedded language, while Python is an object-oriented, literal translation It is a computer programming language and a powerful and complete general-purpose language...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn