Why do python have so many convenient libraries and C + + few?

Source: Internet
Author: User
For example, Python's matplotlib library bar, very convenient and even built-in from the Yahoo finance data on the class, even the regular expression do not have to lose ... C + + is a lot less than the library ... Even if there's a lot of code that looks messy (presumably because of the naming rules, I've seen the C + + code that uses Java naming conventions, which is pretty good, so selectively ignoring me), why is Python's library so humane?

Reply content:

First Python has a PIP, which is easy to publish and retrieve.
Next Python's library, basically all generic, pip down can be used directly. Only for Py2 libraries, and also very few.
and C + + library, and do not say a bunch of libraries can only be used under Linux, a bunch can only be used under win. Even if you can use it, ask yourself to compile it again, you will not necessarily succeed, some code is not good, only in some version of the compiler to run, you can only cry.
Compile method of a mess, some only support configure+make, some cmake, and chrome with that thing forget the name. A larger compilation will take several hours to compile the debug and release two versions under win.
Compile well, use the time also to configure the header file path, the library file path, link to use when the link. Accidentally there will be a variety of link errors can not be found.

The Python library is also easy to do, and you can use the existing library to save development. and the C + + library? You want to steal a little lazy, with some third-party libraries in your library, just let others compile the time more trouble.

In addition a lot of C + + library, itself with a certain learning role, after you understand, you can make a more suitable for their own library out, anyway, C + + development is slow, no longer slower so little time. convenience means shielding more details.

This may be a philosophical question. Like some people think that Apple is good, because some people do not need to know what installation package Ah, file management ah. But I also have some people like Android, like to manage those files, like that transparent. It may also be like if you want to get something handy around you, you need to put as few things around. When you need more and more things around the time, it is certainly inconvenient.

So one of my points is, I venture to speculate that the main reason that Python has a lot of libraries to use is more convenient, because the needs of the Lord are very basic. If the requirements are complex, the pursuit of detail, for each of the things used in every detail of the requirements can be customized, the main topic of the most convenient Python library is not as convenient as the main idea, even some of the details you requested, the library does not provide you with customized methods.

Casually say an example (may not be so rigorous, gather live to listen to): Simply say save a picture, in Python inside with PIL is save so simple, name with suffix other not need to ignore. Well, if it was me, maybe I would have a doubt, I brought a. png suffix whether you save the Png8 or Png24 png32. If I want to save the format I want, I have to check, there is no corresponding method.

C + + 's class library is designed to allow professional users to write professional programs. This requires the use of people with a relatively high level, if you play the picture, you have to understand all aspects of the picture. At the time of initialization you should write clearly whether you need an alpha channel, 32-bit, 16-bit, or 8-bit color.

How many dpi is your picture, and how much is it when the picture is displayed on the screen?
these things don't need to be ignored when you need them simple., you use only the show in the Python library, which you will find convenient.

Of course, I'm not saying that Python can't handle this. Of course, Python is also possible. But when Python writes a professional program, the main problem is that many libraries are as cumbersome as C + + libraries.

I also think many of Python's libraries are useful, but it's important to look at what needs to compare with C + + libraries.

Outside the question:
C + + libraries are sometimes less natural on the call, and sometimes have a little relationship with it.

A memory-managed language and memory requires a program Ape's own management of the language, in the class library method design is very different. Because it's often a struggle to return the information the caller needs without allocating more memory. That might have been a strange, bizarre, lame, and even impossible call to make.

This example is similar to the string split, which the main topic looks at.
There is no itoa in C library and the reason why string in C + + does not have split method

This is not a good idea right now, but one thing to be sure of is that every C + + class library Designer will have such a problem. Nor does it preclude them from being able to think of better ways and then to design the library method very anti-human.

=====================================================================
Late at night to answer this, write the deletion, delete the change, just because suddenly have a feeling, a year or two ago with the title of the same problem has puzzled. However, I believe that time will allow the Lord to have a deeper understanding of the problem ... Python is simple, simple to "12-year-old girls teach you how to develop a game with Python" and other cases are not uncommon

Pycode readable (spray-and-scatter), pseudo-code language is not blown out

Another important reason to remove the buff of the language itself is that the py itself encapsulates a lot of complex implementations (often at the cost of sacrificing efficiency), and our code is based on these packages, such as using C + + curl for post requests and Python urllib* for newcomers/ Lazy people of natural selection the latter, through a from import and can expand the many open source library until the emergence of requests such a library, when you use C + + desperately socket I long ago requests.get () resolved, The time saved can also be a few crawlers based on the Requests Library 1. The understanding of the library cannot be limited to the standard library. Python cubby C + + is much too contrary to my knowledge, to ask for statistical data. In addition, because of the user-oriented users, you can cite some Python and C + + does not have something, I can find C + + and Python does not.
What is a 2.Java naming rule that =_=java programmers to design?
3. If I want someone to ignore a static text, I won't let it appear on the screen at all. If you really regret that you have missed your mouth, there is still a chance to erase it.
4.Python is very human. Because the main topic prefers Python, black C + + dare not say it straight. Boost is trying to solve the problem (not optimistic) is also a communication tool, why mobile phones have so many accessories and so many apps? Why the satellite phone is nothing ah, a little human ah?
The requirements are different, the scene is different, the purpose is different.
  • 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.