Python
- Summary
-
Discussion
- What's so attractive about Python?
- How do you classify Python as a language?
- What are some applications where Python is suited?
- I've heard of The Zen of Python. What's that?
- As a developer, how do I get started with Python?
- Can Python be used in embedded systems?
- Can I use Python along with other languages in a single program?
- Milestones
- References
- Further Reading
- Article Stats
- Cite As
Python is a general purpose programming language that blends procedural, functional and object-oriented functionality in scripting mode. It has efficient high-level data structures, powerful flexible string handling and a simple but effective approach to object-oriented programming. Python's elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms. This pseudo-code nature of Python is one of its greatest strengths. It allows you to concentrate on the solution to the problem rather than the language itself. Python has an extraordinarily simple syntax. It's creator, Guido van Rossum, says,
Python is an experiment in how much freedom programmers need. Too much freedom and nobody can read another's code; too little and expressiveness is endangered.
Discussion
-
What's so attractive about Python? - Python can be easy to pick up whether you're a first time programmer or you're experienced with other languages.
- Python allows you to write the programs in fewer lines of code.
- Very clear readable syntax and keywords, with proper indentation a part of syntax checking.
- Declaration of variables is not required. Object-oriented and imperative programming can be mixed.
- Easy to manipulate large data, can perform linear algebra and matrix operations with
pandas
,numpy
,scipy
,scikit-learn
, etc. for machine learning. - Lists, stacks, queues, dictionaries—you name it, Python has it. Moreover, complex data structures like graphs can be easily implemented in python using a list of dictionaries.
-
How do you classify Python as a language? Python is a programming language that lets you work more quickly and integrate your systems more effectively. It's a high-level, interpreted, interactive and object-oriented scripting language. It incorporates modules, exceptions, dynamic typing, very high-level dynamic data types, and classes.
- Python is Interpreted: Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to Perl and PHP.
- Python is Interactive: You can access a Python prompt and interact with the interpreter directly to write your programs.
- Python is Object-Oriented: Python supports object-oriented style or technique of programming that encapsulates code within objects.
- Python is a Beginner's Language: Python is a great language for the beginner-level programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games.
- Python is Portable: It runs on many Unix variants, on macOS, and on Windows 2000 and later.
-
What are some applications where Python is suited? Python is versatile and it's been used in a variety of applications: console programs, GUI apps including games, server-side programming for web/mobile apps including creation or use of web frameworks, apps that handle media (image/audio/video), enterprise apps for ERP or CRM, data-oriented apps that can handle data in various formats and file types, database-driven apps, networking, scientific apps that require complex and intensive numerical computations, software development tools such as build tools, test automation, software delivery tools such as package managers or installers, system administration utilities, etc.
-
I've heard of The Zen of Python. What's that? Back in August 2004, Tim Peters released an informational document that stated best practices or guiding principles that can benefit Python developers. This document was released as PEP20 -- The Zen of Python. Developers who wish to understand them can do so by studying sample Python code.
-
As a developer, how do I get started with Python? Python can be installed on Windows, Linux or Mac. The default Python distribution by the Python Software Foundation can be installed. For scientific applications, the Anaconda distribution is recommended.
Among the IDEs are IDLE, PyDev for Eclipse, PyCharm, Sublime Text, Visual Studio Code, Spyder, etc. Sublime Text and Visual Studio Code are generic editors that can be enhanced with plugins to support Python. For scientific apps, Spyder may be a good IDE to use.
Python comes with an interactive shell but IPython is an enhanced shell that offers more features. Jupyter Notebook allows programmers to combine code, results and descriptions into a nice flow that can be shared with others. IPython and Jupyter Notebook are part of Anaconda distribution.
For installing new packages or updating existing ones,
pip
is the tool to use. Since developers often work on multiple projects, and each project may use different packages or even versions of Python, it's recommended to use virtual environments. A virtual environment can be created usingpip install virtualenv
.PEP8 is a style guide developers should read to make their code more readable and maintainable.
-
Can Python be used in embedded systems? Yes. Devices that could be considered as embedded by modern standards and can run tuned versions of CPython include:
- Gumstix
- Raspberry Pi: The "Pi" in Raspberry Pi comes from Python.
- BeagleBone Black
MicroPython is a lean and efficient implementation of a subset Python 3. It's optimised to run on microcontrollers with as little as 256K of Flash and 16K of RAM. The pyboard is a compact and powerful development board that runs MicroPython. A quick reference to programming the pyboard is available. MicroPython is supported on a number of MCUs, including many variants from STMicroelectronics.
-
Can I use Python along with other languages in a single program? Yes. For example, time-critical code could be in C and this could be invoked from within Python.
In fact, Python is a specification that has been implemented in many different languages. This makes it easier to interface Python with code from other languages. The interpreter compiles Python source code into bytecode and execute on a virtual machine. Following are some existing implementations:
Implementation Virtual Machine Compatible Language CPython CPython VM C Jython Java Virtual Machine Java IronPython CLR C# Brython JavaScript engine (eg. V8) JavaScript RubyPython Ruby VM Ruby Python implementation in RPython (a subset of Python) is called PyPy, which is fast due to JIT (just-in-time) compilation. PyPy aims to be cross-platform, memory-light and stackless-supportive.
Milestones
1989
Guido van Rossum at CWI in the Netherlands encounters some shortcomings with ABC programming language on the Amoeba operating system. He likes the scripting syntax of ABC but doesn't want to create an Amoeba-specific language. So he decides to create an extensible language giving due importance to exception handling. He starts the implementation during 1989 Christmas holidays.
1991
2000
2008
Python 2.6 is released. The development of this release is synchronized with that of Python 3.0. Thus, Python 2.6 incorporates some changes that are part of Python 3.0. This backporting is expected to make way for easier migration of Python 2.6+ code to Python 3.x. Module future_builtins
has 3.0 semantics.
2008
2010
Python 2.7 is released. It includes some features introduced in Python 3.1. Python 2.7.x releases will receive bug fixes as well as backports from Python 3.x to make it easier in future to migrate that code to Python 3. It's the last 2.x release (there won't be a 2.8 release). It's expected to be retired in January 2020, implying that it will be maintained for 10 years since its initial release.
References
- Anand, Chillar. 2014. "14 Great Quotes About Python Programming Language!" December. Accessed 2018-02-18.
- Kuchling, A. M. 2018a. "What’s New in Python 2.6." Python Docs, V3.6.4. Accessed 2018-02-18.
- Kuchling, A. M. 2018b. "What’s New in Python 2.7." Python Docs, V3.6.4. Accessed 2018-02-18.
- Marsh, Charles. 2013. "A Python Implementation Comparison." Toptal. Accessed 2018-02-18.
- MicroPython. 2017. "Boards Summary." GitHub. December 15. Accessed 2018-02-19.
- MicroPython. 2018. "MicroPython." Accessed 2018-02-19.
- MicroPython Docs. 2018. "Quick reference for the pyboard." V1.9.3. Accessed 2018-02-19.
- Peters, Tim. 2004. "PEP20 -- The Zen of Python." Python.org. August 19. Accessed 2018-02-18.
- Putano, Ben. 2017. "Most Popular and Influential Programming Languages of 2018." Stackify. December 18. Accessed 2018-02-19.
- Python Clock. 2018. "Python 2.7 will retire in..." Accessed 2018-05-26.
- Python Docs. 2018a. "General Python FAQ." V3.6.4. Accessed 2018-02-18.
- Python Docs. 2018b. "Changelog." V3.6.4. Accessed 2018-02-18.
- Python Wiki. 2016. "Embedded Python." May 3. Accessed 2018-02-20.
- Python Wiki. 2018. "Applications Written in Python." January 30. Accessed 2018-02-18.
- Python.org. 2018a. "The Python Logo." Accessed 2018-02-18.
- Python.org. 2018b. "Python Software Foundation." Accessed 2018-02-19.
- Vilches, Jose. 2012. "Interview with Raspberry's Founder Eben Upton." May 22. Accessed 2018-02-19.
- Wood, Sam. 2015. "A Brief History of Python." October 14. Accessed 2018-02-18.
- Yegulalp, Serdar. 2018. "What is Python? Everything you need to know." InfoWorld, June 1. Accessed 2018-06-05.
- effbot.org. 2018. "Why was Python created in the first place?" Accessed 2018-02-18.
- ewjoachim. 2013. "Zen of Python Poster." Devian Art. August 31. Accessed 2018-02-18.
- noeticsunil. 2017. "Python IDE: The10 Best IDEs for Python Programmers." noeticforce. August 31. Accessed 2018-02-19.
- van Rossum, Guido, Barry Warsaw, and Nick Coghlan. 2001. "PEP 8 -- Style Guide for Python Code" Python.org. July 5. Accessed 2018-02-18.
Further Reading
- Yegulalp, Serdar. 2018. "What is Python? Everything you need to know." InfoWorld, June 1. Accessed 2018-06-05.
- Python Docs. 2018a. "The Python Tutorial." V3.6.4. Accessed 2018-02-18.
- Python Docs. 2018b. "The Python Standard Library." V3.6.4. Accessed 2018-02-18.
- Hettinger, Raymond. 2013. "Transforming Code into Beautiful, Idiomatic Python." YouTube, May 20. Accessed 2018-02-18.