How we work with Python

How we work with Python

Python is a script programming language with abstract data structures and a simple but effective approach to object-oriented programming. The program code is executed at runtime by an interpreter with a corresponding runtime environment.

Python was developed in the 1990s by Guido van Rossum, who designed it as a successor to the programming language ABC. Although the name and the icon used suggest a connection to the snake of the same name, the name Python has its origin as a reference to the English comedy troupe "Monty Python".

 

Intuitive and expressive

As a programming language, Python is extremely intuitive, easy to learn, and promotes a clean and readable programming style in its use. In addition, the written code is very expressive, reducing the number of lines written. This makes Python easy for beginners, but also offers many possibilities for experienced developers.

An important point in which Python differs from most other programming languages is the general structure of the code: Function blocks are not delimited by braces, but by indentation. This results in a clear and concise functional picture. Likewise, Python enables a quick implementation of ideas (rapid prototyping). A disadvantage in direct comparison to static or compiler languages such as C or C++ is the sometimes significantly lower execution speed, due to the interpretative execution of the program code at runtime.

Python is constantly being further developed. Currently (at the time of this application description: 09.2020) it is in version 3.8. A special feature of the further development is that the change from Python 2 to version 3 caused a fundamental incompatibility. A program executable with Python 2 may not be executable with Python 3 and vice versa. The official support for Python 2 was discontinued as of 01.01.2020.

 

In addition to the points already mentioned, Python offers other advantages, such as:

- a very extensive standard library and functions, mostly platform independent (Windows, Linux, macOS, ...).

- a large open source community with extensive tutorials and help

- the possibility of adding modules written in C or Python to the existing libraries

Python in der Praxis

Due to its scope and versatility, Python is suitable for a very wide range of applications. It is used for data analysis, automation, front- and back-end development and countless other applications. Google, for example, has chosen Python as its standard scripting language for web applications.

 

Its use in the field of machine learning and AI development is particularly noteworthy, and its structure and nature (stability, flexibility, existing tools and extensions, etc. ...) make it an excellent choice. Python libraries that can be used for this purpose include Tensor Flow, NumPy and PyTorch. It is precisely because it is relatively easy to read and understand that Python is so well suited for complex and complicated topics.

 

Integration on the sysWORXX CTR-700

As mentioned above, the Python standard library is largely platform independent. On the Linux distribution of the sysWORXX CTR-700 used, Python (in versions 2 and 3) can therefore be used without any problems. Specifically, versions 2.7.13 and 3.5.3 are supported for Debian Stretch.

In addition to the extensive standard libraries, a driver library is also available for the sysWORXX CTR-700, with which Python applications can directly access the hardware of the edge controller device. Using this library, an application can use the digital inputs and outputs for one of the controllers, but can also communicate via the serial (RS-232/RS-485/Modbus RTU) or CAN interfaces. Compared to conventional development on embedded systems, there are hardly any limitations, but there are advantages of Python, which are fully exploited compared to C or C++.

Read more? Here you can find the complete application description.