Download Now - It's Free Install Now - It's Free

The Python Language

Python is a fully-featured, general purpose programming language for developing web and desktop applications.

Python Overview

Python is a general-purpose programming language which promotes readability and rapid development. Python is widely used in science, mathematics, business, and web development. Both web and desktop applications are written in Python, with either graphical or command-line interfaces. A fully-featured, object-oriented language, Python is also suitable for procedural and functional programming paradigms. Python is cross-platform, free and open-source, and easier to read and write than other languages with similar features.

Python Language Specifics

Installation and execution

As a semi-interpreted language, a version of the Python interpreter must be installed in order to run any Python application. Developers most commonly acquire the desired version as distributed by the Python Software Foundation via Python.org. Python programs may be entered and executed line by line in an interactive prompt, or as files ending with the “.py” extension. A single file is referred to as a “module.” Python is visually recognizable by the meaningful use of whitespace to separate blocks of code. The import statement allows the execution of code from other modules, which is commonly used to change system state, or to make functions and classes available that are not defined in the current module.

Python Versions

Interpreter versions determine which features of the core Python language are available to a Python application, and how those features may be used. For example, a “print” statement may be called with the keyword print in Python 2, but in Python 3, the same behavior must be called as the print() function. Changes are made with the intention of more closely following Python Enhancement Protocols (PEPs). The first version of Python (1.0) was released by Guido van Rossum in 1991, with Python 2.0 released in 2000. Although Python 3.0 was released in 2008, the slow uptake of Python 3 by the community resulted in two incompatible versions in use for a number of years. Today, many legacy applications are maintained for Python 2 (usually 2.7), but Python 3 is now the accepted standard, and more popular. Developers are encouraged to use Python 3. Although Python 3 is not backward compatible with Python 2, fundamental concepts, types, and most keywords remain the same. Python 2 will no longer be supported starting in 2020. Applications are usually compatible between ranges of minor releases but not major releases, as Python 3.x is not backward-compatible with Python 2.x. For example, an application may specify Python 3.4+, meaning it will run with any of 3.4, 3.5, etc. Such an application would need significant changes to be executed in Python 2.7.

Python Implementations

Although Python may be thought of as an interpreted language (code is compiled only at run-time), the standard implementation of Python (CPython) is written in C, allowing much of Python to be compiled prior to passing a statement to the interpreter. The CPython implementation has the effect of dramatically improving performance. Thus, developers may refer to Python as a “semi-interpreted” language. Additionally, because Python is a language specification rather than an implementation, there are many other implementations of Python including Jython (compiles to the Java runtime), PyPy, IronPython, and even MicroPython for microcontroller hardware.

Typing

Python is a dynamically and strongly-typed language. This means that an object need not be declared as a particular data type, but must be explicitly converted to other object types. Python will raise a TypeError up-front if an object is not explicitly converted instead of attempting to convert the object, as happens in weakly-typed languages.

Abstracted Memory Management

Like many higher-level languages, Python abst racts memory management such that it need not be handled explicitly in a Python application. Python implementations maintain a reference count to objects in memory, so that when the reference count is zero, memory is automatically freed for storage.

Python Vs Other Programming Languages

Python’s meteoric growth is generally attributed to its rapid development cycle, intuitive readability, and wide array of open-source packages, which sets it apart from other languages. As a fully-featured, object-oriented language, Python is most-often compared to Java and C/C++. In these comparisons, Python suffers in hardware performance, but excels at speed of collaboration and development. For example, although Java is not sensitive to whitespace, source code is more verbose and comparatively difficult to type and read, and may only be executed in the memory-intensive Java runtime. While C/C++ is far more effective in hardware performance and native desktop applications, the need to explicitly manage memory makes it less practical for prototyping, collaboration, learning, and web technologies.

Python Community and Ecosystem

Python is intended to be fun, lighthearted, and even whimsical – named as tribute to the British comedy group Monty Python. Example code often contains humorous references as variable names and values. An active community of developers creates and maintains powerful tools, such as Pandas, SQLalchemy, and Numpy, under the guidance of the Python Software Foundation (PSF).

Free and Open-Source

The Python language is free and open-source, as its license allows distribution for either free or commercial applications. Additionally, the source code for any package is usually distributed as human-readable text files, and may be changed or distributed according to its own license. Because Python applications are not distributed as compiled, executable files, they are not naturally obfuscated and may be easily read and uderstood.

Style Principles

Python Enhancement Protocols (PEPs) state principles which guide developers both in style and structural approach, specifically PEP 20 “The Zen of Python” and PEP 8 “Python Style Guide.” Accordingly, Python is known for two major concepts: the idea of pythonic code and the “Batteries Included” approach. The full collection of PEPs encompasses the history of the Python language and community. Code is pythonic when it follows the conventions of clarity and maintainability. Although Python is “self-documenting” (documentation strings may be accessed easily from command line applications), the community prefers readability through descriptive naming and and proper formatting. Additionally, Python language keywords are explicit and intuitive. The purposes of Lists and Dictionaries, for example, are easy for novices and experts in other fields to understand, compared to equivalent types in other languages. Pythonic code also refers to the idea that “there should be one—and preferably only one—obvious way to do it.” There are many ways to solve problems in Python, but the “obvious” solution will more closely follow language principles.

Batteries Included

“Batteries Included” means that Python is distributed throughout a standard library of packages covering a wide array of use-cases, without requiring installation of third-party packages. Select libraries are installed along with the Python language to handle low-level tasks like threading, memory-management, and making connections via internet protocols. However, in practice, it’s common for a Python application to add third-party tools. Many professionals use Python because of specific tools and frameworks. For example, a Data Scientist may use Python solely to access the Pandas package for data analysis, or a Web Developer may use Python to implement a website with the Flask or Django frameworks. Taken together, the standard library and community packages distributed via the Python Package Index (PyPI) enable both novice and experienced developers to contribute effective, maintainable code.

Rapid Growth and Outlook

Python has been in use for nearly thirty years but has gained traction with developers only recently. Python has seen sustained growth since becoming the language of choice for universities in 2014, and is now described as the world’s fastest growing language. In 2018, the IEEE ranked Python as the world’s number one programming language, and, in the same year, Github ranked Python as the third most popular language by number of contributors, behind Java and JavaScript, with 40% of professional developers listing Python as a skill. The suitability of the language specification for rapid-prototyping and collaboration gives Python an edge over languages which require more specialized expertise. Because the language is actively maintained, and suitable for many commercial and academic use-cases, Python will continue to be a desirable competency for the foreseeable future.

AI-Powered Python Copilot

Kite integrates with your code editor and uses machine learning to turbocharge your programming experience.

Download Kite Now!

Check your inbox on your computer! Your download link has been sent.