Why does Python not use C ++?

Source: Internet
Author: User
In the python source code, the C code has been completely object-oriented, and features such as encapsulation and polymorphism have been implemented in C. Why not directly connect to C ++? This can also make the code more readable. in python source code, the C code has been fully object-oriented, And the encapsulation, polymorphism, and other features have been implemented in C. Why not directly connect to C ++? This can also make the code more readable and reply to the content: see:
Why is Python written in C and not in C ++? Http://programmers.stackexchange.com/questions/20988/why-is-python-written-in-c-and-not-in-c

1. CPython 1.0 was released in 1989, when C was just standardized and C ++ was unknown
2. C has better portability than C ++
3. rewriting the code is a big project. Why does CPython use C instead of C ++? @'s answer is already clear.

As for why we don't need C ++ to implement Python today, the subject is the Pyston of Dropbox. The Python encapsulation and polymorphism features implemented by C ++ do not use the OOP language at all. Implementation inheritance is a feature that can be easily implemented only when it is not in the OOP language ). So let me say that people who love OO should first look at how little inheritance is implemented in your system. In reality, except for the UI framework, there is no need to use implementation inheritance. From the implementation of Python source code, we can think that Python and C ++ provide object-oriented "extensions" for the C language respectively, and their "extension" ideas are different, C ++ minimizes the performance loss as much as possible, while Python is all designed to simplify the high-level view of objects, therefore, Python development with C does not need to go through C ++'s understanding of object-oriented, directly build another tall building based on your own ideas using the underlying materials. In many large C projects, either or part of them adopt the object-oriented thinking, using C language to write some encapsulation similar to object encapsulation, this is only to better organize the entire project with the object-oriented idea. it doesn't mean that writing an object-oriented language requires another object-oriented language.

There are also many languages written in C at the underlying layer, and many Network Libraries and network tools. I personally think:
1. The C language is closer to the underlying operating system and can be more coupled with the operating system (you can think about why LINUX does not need to write C ++)
2. C language makes cross-platform better. In view 1, the operating system is written in C because CPython is too old, pyston, which uses the new architecture based on CPython, is implemented in C ++ 11. Python is implemented in windows by calling APIs. C is sufficient. Only C ++ can be used for MFC. The development of object-oriented languages is often lost.

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.