官术网_书友最值得收藏!

Introduction to Python

Since its introduction by Guido van Rossum in 1991, Python has grown into one of the most widely used general-purpose, high-level programming languages, and is supported by one of the largest open source developer communities. Python is an open source programming language that includes a lot of supporting libraries. These libraries are the best feature of Python, making it one of the most extensible platforms. Python is a dynamic programming language, and it uses an interpreter to execute code at runtime rather than using a compiler to compile and create executable byte codes.

The philosophy behind the development of Python was to create flexible, readable, and clear code to easily express concepts. The emphasis on using whitespace indentation in a unique way differentiates Python from other popular high-level languages. Python supports functional, imperative, and object-oriented programming with automatic memory management.

Why we use Python

Python is considered to be one of the easiest languages to learn for first-time programmers. Compared to other popular object-oriented languages such as C++ and Java, Python has the following major benefits for programmers:

  • It is easy to read and understand
  • It enables rapid prototyping and reduces development time
  • It has a humongous amount of free library packages

Python has a huge open source community that drives forth the effort for continuous improvement of Python as a programming language. The Python community is also responsible for the development of a large amount of open library packages, which can be used to build applications that span from dynamic websites to complex data analysis applications, as well as the development of simple GUI-based applications to plot charts from complex math functions. The majority of Python library packages have systematically maintained the code that was obtained from the community with regular updates. The de facto repository that indexes the largest number of Python packages is PyPI (http://pypi.python.org). PyPI also provides simple ways to install various packages on your operating system, which will be covered in the upcoming section.

While working with the hardware platform, it is necessary to have some means of communication between the hardware and the computer that you are using for development. Among the common computer to hardware interfacing methods, serial- port-based communication is the most popular, and it is really simple to establish, especially for the Arduino platform. Python provides a library called pySerial that is really easy to use and quick to implement to interface a serial port. It is really simple to use similar libraries and Python's interactive programming abilities to rapidly test and implement your project ideas.

Nowadays, complex Internet of Things (IoT) applications not only require serial communication support, but they also need additional high-level features such as graphical user interfaces (GUIs) for operating systems, web interfaces for remote access, plots for data visualization, tools for data analysis, interfaces for data storage, and so on. Using any other programming language such as C++ or Java, the development of these features would require a large amount of programming effort due to the distributed and unorganized nature of the supporting tools. Thankfully, Python has been very successful at providing support for these types of applications for years. Python has a number of libraries to support the development of each of the features mentioned here, which are available through PyPI. These libraries are open source, easy to use, and widely supported by the community. This makes Python a language of choice for IoT applications. Additionally, Python also has support to create and ship your custom-built applications as libraries so that everyone else can also utilize them in their projects. This is a helpful feature if you are developing custom protocols, APIs, or algorithms for your own hardware products.

When do we use other languages

So, when should we not use Python for our projects? As mentioned earlier, Python is a dynamic language that reduces development time, but it also makes the execution of your code slower as compared to other static high-level languages such as C, C++, and Java. These static languages use a compiler to compile the code and create binaries that get executed during runtime, thereby increasing the runtime performance. When the performance of the code is more important than a longer development time and higher cost, you should consider these static languages. Some other drawbacks of Python include being memory heavy, not having the proper support for threading, and lacking data protection features. In short, we can say that even though Python provides quicker and easier ways for quick prototyping, we should consider other static high-level languages for development after we are done testing our prototype and we are ready to ship our product. Nowadays, this scenario is changing rapidly and companies have started utilizing Python for their industrial products.

Note

You can obtain more Python-related information from the official website at http://www.python.org.

主站蜘蛛池模板: 新密市| 宽甸| 北京市| 高台县| 阜南县| 阿合奇县| 个旧市| 建阳市| 大宁县| 苗栗市| 周宁县| 广河县| 临高县| 麟游县| 柳江县| 同江市| 奉节县| 垫江县| 沅江市| 湟中县| 徐州市| 贺州市| 台湾省| 温州市| 泸定县| 长海县| 南平市| 江陵县| 且末县| 江城| 泰兴市| 泗水县| 湖北省| 芦溪县| 平江县| 固原市| 兴和县| 清徐县| 怀来县| 古交市| 玉溪市|