Raspberry Pi_Eng_23.5.1 Python Overview


Published Book on Amazon


All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2


출판된 한글판 도서


최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)


Original Book Contents


23.5   Python language

 

23.5.1  Python Overview

 

23.5.1.1    What is Python?

 

Python is an advanced programming language developed by Guido van Rossum, a 1991 programmer. It is flexible, powerful, and easy to use. Python currently has been managed by a nonprofit Python Software Foundation and has an open-source and community-based development model.

 

Python is a platform-independent, interpreting-method, object-oriented, dynamically typed, interactive language. Python syntax also has a grammatical structure that can be expressed clearly, an easy-to-read structure, and uses standard English-like keywords.

 

Python has a broad user base from beginners to experts. It is a general-purpose program language that supports dynamic typing. As it can be used on various platforms and has abundant libraries, it is increasingly used in university, educational institution, research institute, and industry. Python is often used as a glue language to connect modules written in other languages, in addition to the featurs of a pure programming language. Actually Python is being adopted as a scripting language in many commercial applications.

 

If you need more advanced information about Python, you should consider the following subjects additionally:

    Python 2 and Python 3

    Conventions in Python

    Various Usage of Python

    Installation of Python library

    GPIO Utilization

 

 

For more information on Python, please refer to the followings:

    https://www.python.org/doc                                    -- Python Documentation

    http://wiki.python.org/moin/BeginnersGuide    -- Official Beginner's Guide

    http://www.learnpython.org                         -- Free interactive tutorials

    http://learnpythonthehardway.org/                -- Zed A. Shaw's Python book

 

 

23.5.1.2    Python 2 and Python 3

 

Python currently supports two versions of Python 2 and Python 3. Python 3 is a newer version than Python 2, but it is not guaranteed to be fully compatible with Python 2. Because many programs developed in Python 2 in the past could not be processed in Python 3, Python 2 still has to be used for the time being. However, Python 3 is new in every way and it shows better performance, so Python 3 will be used everywhere in the future.

 

In Raspberry Pi system, Python development environment Python 2 and Python 3 are provided together. You can use anything you like, but if you are developing a new program, you should use Python 3.

 


 

23.5.1.3    IDLE Tool of Python

 

Many development languages ​​typically provide a specialized integrated development environment (IDE) for ease of development. An integrated development environment (IDE) is a development tool that provides a development environment that integrates all the tools necessary for program development and makes them easy-to-use.

 

Python also provides IDLE (Integrated Development and Learning Environment) as a basic integrated development environment.

 

Python IDLE provides users with a REPL (Read-Evaluate-Print-Loop) prompt for entering Python commands easily, executing it, and checking the results. This is literally REPL, so it displays the execution result of command without actually using "print" command.

 

If necessary, variable can be used, and it can be used just like calculating. Let's look at some examples.

 

>>> 1 + 2
3
>>> name = "Sarah"
>>> "Hello " + name
'Hello Sarah'

 

Python IDLE internally has syntax highlighting function, and supports autocompletion partly. You can also look back at the commands you have previously entered in the REPL. If you use [Alt + P] (previous) and [Alt + N] (next), you can navigate forward and backward and confirm those commands.