Python

The Python Logo. Source: Python.org, 2018.
The Python Logo. Source: Python.org, 2018.

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 features. Source: Devopedia, 2017.
    Python features. Source: Devopedia, 2017.

    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?
    The Zen of Python. Source: ewjoachim, 2013.
    The Zen of Python. Source: ewjoachim, 2013.

    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 using pip 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:

    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?
    A flow that illustrates how Python is compiled and interpreted. Source: Marsh, 2013.
    A flow that illustrates how Python is compiled and interpreted. Source: Marsh, 2013.

    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:

    ImplementationVirtual MachineCompatible Language
    CPythonCPython VMC
    JythonJava Virtual MachineJava
    IronPythonCLRC#
    BrythonJavaScript engine (eg. V8)JavaScript
    RubyPythonRuby VMRuby

    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

Dec
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.

Feb
1991

Guido van Rossum uploads Python to USENET, thus making it publicly available for the first time.

Oct
2000

Python 2.0 is released. Starting from this release, the development of the language becomes more open and community driven.

Oct
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.

Dec
2008

Python 3.0 is released. It simplifies some of the unwieldy syntax that was in Python 2.x. It's not backward compatible with Python 2.x and hence its release is seen as controversial. However, Python 3.x is the future of the language.

Jul
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.

Dec
2017

Python 3.6.4 is released. In 2017, Python was ranked among the top 5 languages. Python is promoted and managed by the Python Software Foundation.

References

  1. Anand, Chillar. 2014. "14 Great Quotes About Python Programming Language!" December. Accessed 2018-02-18.
  2. Kuchling, A. M. 2018a. "What’s New in Python 2.6." Python Docs, V3.6.4. Accessed 2018-02-18.
  3. Kuchling, A. M. 2018b. "What’s New in Python 2.7." Python Docs, V3.6.4. Accessed 2018-02-18.
  4. Marsh, Charles. 2013. "A Python Implementation Comparison." Toptal. Accessed 2018-02-18.
  5. MicroPython. 2017. "Boards Summary." GitHub. December 15. Accessed 2018-02-19.
  6. MicroPython. 2018. "MicroPython." Accessed 2018-02-19.
  7. MicroPython Docs. 2018. "Quick reference for the pyboard." V1.9.3. Accessed 2018-02-19.
  8. Peters, Tim. 2004. "PEP20 -- The Zen of Python." Python.org. August 19. Accessed 2018-02-18.
  9. Putano, Ben. 2017. "Most Popular and Influential Programming Languages of 2018." Stackify. December 18. Accessed 2018-02-19.
  10. Python Clock. 2018. "Python 2.7 will retire in..." Accessed 2018-05-26.
  11. Python Docs. 2018a. "General Python FAQ." V3.6.4. Accessed 2018-02-18.
  12. Python Docs. 2018b. "Changelog." V3.6.4. Accessed 2018-02-18.
  13. Python Wiki. 2016. "Embedded Python." May 3. Accessed 2018-02-20.
  14. Python Wiki. 2018. "Applications Written in Python." January 30. Accessed 2018-02-18.
  15. Python.org. 2018a. "The Python Logo." Accessed 2018-02-18.
  16. Python.org. 2018b. "Python Software Foundation." Accessed 2018-02-19.
  17. Vilches, Jose. 2012. "Interview with Raspberry's Founder Eben Upton." May 22. Accessed 2018-02-19.
  18. Wood, Sam. 2015. "A Brief History of Python." October 14. Accessed 2018-02-18.
  19. Yegulalp, Serdar. 2018. "What is Python? Everything you need to know." InfoWorld, June 1. Accessed 2018-06-05.
  20. effbot.org. 2018. "Why was Python created in the first place?" Accessed 2018-02-18.
  21. ewjoachim. 2013. "Zen of Python Poster." Devian Art. August 31. Accessed 2018-02-18.
  22. noeticsunil. 2017. "Python IDE: The10 Best IDEs for Python Programmers." noeticforce. August 31. Accessed 2018-02-19.
  23. 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

  1. Yegulalp, Serdar. 2018. "What is Python? Everything you need to know." InfoWorld, June 1. Accessed 2018-06-05.
  2. Python Docs. 2018a. "The Python Tutorial." V3.6.4. Accessed 2018-02-18.
  3. Python Docs. 2018b. "The Python Standard Library." V3.6.4. Accessed 2018-02-18.
  4. Hettinger, Raymond. 2013. "Transforming Code into Beautiful, Idiomatic Python." YouTube, May 20. Accessed 2018-02-18.

Article Stats

Author-wise Stats for Article Edits

Author
No. of Edits
No. of Chats
DevCoins
11
3
1257
2
0
1057
4
1
305
1
0
19
1
1
18
1296
Words
16
Likes
9310
Hits

Cite As

Devopedia. 2022. "Python." Version 20, February 15. Accessed 2024-06-26. https://devopedia.org/python
Contributed by
6 authors


Last updated on
2022-02-15 12:06:36