Python is an translate high-level general-purpose scheduling language. Its design philosophy emphasizes code readability with its use of significant indentation. Its lyric constructs ampere well as its object-oriented approach aim to help programmers write clear up, coherent code for modest and large-scale projects. [ 31 ] Python is dynamically-typed and garbage-collected. It supports multiple program prototype, including structured ( particularly, adjective ), object-oriented and functional program. It is frequently described as a “ batteries included ” lyric due to its comprehensive standard library. [ 32 ] [ 33 ]
Guido van Rossum began working on Python in the late 1980s, as a successor to the ABC programming lyric, and first released it in 1991 as Python 0.9.0. [ 34 ] Python 2.0 was released in 2000 and introduced newfangled features, such as list comprehensions and a cycle-detecting garbage collection arrangement ( in addition to reference count ). Python 3.0 was released in 2008 and was a major revision of the speech that is not wholly backward-compatible. Python 2 was discontinued with translation 2.7.18 in 2020. [ 35 ] Python systematically ranks as one of the most popular program languages. [ 36 ] [ 37 ] [ 38 ] [ 39 ]
Contents
history
Python was conceived in the recently 1980s [ 40 ] by Guido van Rossum at Centrum Wiskunde & Informatica ( CWI ) in the Netherlands as a successor to the ABC program linguistic process, which was inspired by SETL, [ 41 ] capable of exception handle and interfacing with the Amoeba manoeuver system. [ 11 ] Its execution began in December 1989. [ 42 ] Van Rossum shouldered sole province for the project, as the conduct developer, until 12 July 2018, when he announced his “ permanent vacation ” from his responsibilities as Python ‘s “ benevolent dictator for liveliness “, a deed the Python community bestowed upon him to reflect his long-run commitment as the project ‘s head decision-maker. [ 43 ] In January 2019, active Python core developers elected a five-member “ Steering Council ” to lead the visualize. [ 44 ] [ 45 ] Python 2.0 was released on 16 October 2000, with many major new features, including a cycle-detecting garbage collector ( in summation to reference count ) for memory management and defend for Unicode. [ 46 ] Python 3.0 was released on 3 December 2008. It was a major revision of the lyric that is not completely backward-compatible. [ 47 ] Many of its major features were backported to Python 2.6.x [ 48 ] and 2.7.x translation series. Releases of Python 3 include the 2to3
utility, which automates the translation of Python 2 code to Python 3. [ 49 ] Python 2.7 ‘s end-of-life date was initially set at 2015 then postponed to 2020 out of concern that a boastfully body of existing code could not easily be forward-ported to Python 3. [ 50 ] [ 51 ] No more security patches or other improvements will be released for it. [ 52 ] [ 53 ] With Python 2 ‘s end-of-life, lone Python 3.6.x [ 54 ] and former are supported. Python 3.9.2 and 3.8.8 were expedited [ 55 ] as all versions of Python ( including 2.7 [ 56 ] ) had security issues, leading to possible distant code performance [ 57 ] and web cache poison. [ 58 ]
Design philosophy and features
Python is a multi-paradigm program terminology. Object-oriented scheduling and structured program are in full supported, and many of its features support functional program and aspect-oriented scheduling ( including by metaprogramming [ 59 ] and metaobjects ( charming methods ) ). [ 60 ] Many other paradigms are supported via extensions, including design by contract [ 61 ] [ 62 ] and logic scheduling. [ 63 ] Python uses moral force type and a combination of reference book count and a cycle-detecting garbage collector for memory management. [ 64 ] It besides features moral force list resolution ( late constipate ), which binds method and variable names during program execution. Python ‘s design offers some support for functional program in the Lisp custom. It has filter
, map
and reduce
functions ; tilt comprehensions, dictionaries, sets, and generator expressions. [ 65 ] The standard library has two modules ( itertools
and functools
) that enforce functional tools borrowed from Haskell and Standard ML. [ 66 ] The language ‘s core philosophy is summarized in the document The Zen of Python ( PEP 20 ), which includes aphorisms such as : [ 67 ]
- Beautiful is better than ugly.
- Explicit is better than implicit.
- Simple is better than complex.
- Complex is better than complicated.
- Readability counts.
rather than having all of its functionality built into its effect, Python was designed to be highly extensile ( with modules ). This compact modularity has made it particularly popular as a mean of adding programmable interfaces to existing applications. Van Rossum ‘s vision of a small core language with a big standard library and well extensile interpreter stemmed from his frustrations with ABC, which espoused the inverse approach. [ 40 ] Python strives for a simple, less-cluttered syntax and grammar while giving developers a choice in their code methodology. In line to Perl ‘s “ there is more than one way to do it “ motto, Python embraces a “ there should be one— and preferably only one —obvious way to do it ” design philosophy. [ 67 ] Alex Martelli, a Fellow at the Python Software Foundation and Python bible author, writes that “ To describe something as ‘clever ‘ is not considered a compliment in the Python acculturation. ” [ 68 ] Python ‘s developers strive to avoid premature optimization, and reject patches to non-critical parts of the CPython reference execution that would offer bare increases in speed at the cost of clarity. [ 69 ] When travel rapidly is important, a Python programmer can move time-critical functions to extension modules written in languages such as C, or use PyPy, a just-in-time compiler. Cython is besides available, which translates a Python script into C and makes address C-level API calls into the Python interpreter. Python ‘s developers aim for the speech to be fun to use. This is reflected in its name—a protection to the british comedy group Monty Python [ 70 ] —and in occasionally playful approaches to tutorials and reference materials, such as examples that refer to spam and eggs ( a reference to a Monty Python sketch ) rather of the criterion foo and bar. [ 71 ] [ 72 ] A common neologism in the Python community is pythonic, which can have a broad range of meanings related to program style. To say that code is pythonic is to say that it uses Python idioms good, that it is natural or shows fluency in the speech, that it conforms with Python ‘s minimalist doctrine and emphasis on readability. In contrast, code that is difficult to understand or reads like a crude transcription from another program lyric is called unpythonic. [ 73 ] [ 74 ] Users and admirers of Python, specially those considered intimate or experienced, are much referred to as Pythonistas. [ 75 ] [ 76 ]
Syntax and semantics
Python is meant to be an easily clear linguistic process. Its format is visually unclutter, and it frequently uses english keywords where early languages use punctuation. Unlike many other languages, it does not use curly brackets to delimit blocks, and semicolons after statements are allowed but are rarely, if ever, used. It has fewer syntactic exceptions and extra cases than C or Pascal. [ 77 ]
indentation
Python uses whitespace pitting, quite than curly brackets or keywords, to delimit blocks. An addition in pitting comes after certain statements ; a decrease in indentation signifies the end of the stream block. [ 78 ] Thus, the program ‘s ocular structure accurately represents the program ‘s semantic structure. [ 79 ] This sport is sometimes termed the off-side rule, which some other languages parcel, but in most languages pitting does not have any semantic entail. The recommend indent size is four spaces. [ 80 ]
Statements and control flow
Python ‘s statements include ( among others ) :
- The assignment statement, using a single equals sign
=
. - The
if
statement, which conditionally executes a block of code, along withelse
andelif
(a contraction of else-if). - The
for
statement, which iterates over an iterable object, capturing each element to a local variable for use by the attached block. - The
while
statement, which executes a block of code as long as its condition is true. - The
try
statement, which allows exceptions raised in its attached code block to be caught and handled byexcept
clauses; it also ensures that clean-up code in afinally
block will always be run regardless of how the block exits. - The
raise
statement, used to raise a specified exception or re-raise a caught exception. - The
class
statement, which executes a block of code and attaches its local namespace to a class, for use in object-oriented programming. - The
def
statement, which defines a function or method. - The
with
statement, which encloses a code block within a context manager (for example, acquiring a lock before the block of code is run and releasing the lock afterwards, or opening a file and then closing it), allowing resource-acquisition-is-initialization (RAII)-like behavior and replaces a common try/finally idiom.[81] - The
break
statement, exits from a loop. - The
continue
statement, skips this iteration and continues with the next item. - The
del
statement, removes a variable, which means the reference from the name to the value is deleted and trying to use that variable will cause an error. A deleted variable can be reassigned. - The
pass
statement, which serves as a NOP. It is syntactically needed to create an empty code block. - The
assert
statement, used during debugging to check for conditions that should apply. - The
yield
statement, which returns a value from a generator function andyield
is also an operator. This form is used to implement coroutines. - The
return
statement, used to return a value from a function. - The
import
statement, which is used to import modules whose functions or variables can be used in the current program.
The assignment statement ( =
) operates by binding a list as a reference point to a separate, dynamically-allocated object. Variables may subsequently be rebound at any time to any object. In Python, a variable star appoint is a generic reference point holder and does not have a fixed datum type associated with it. however, at a given clock, a varying will refer to some object, which will have a type. This is referred to as dynamic type and is contrasted with statically-typed programming languages, where each variable may only contain values of a certain type. Python does not support dock visit optimization or excellent continuations, and, according to Guido van Rossum, it never will. [ 82 ] [ 83 ] however, better corroborate for coroutine -like functionality is provided, by extending Python ‘s generators. [ 84 ] Before 2.5, generators were faineant iterators ; information was passed unidirectionally out of the generator. From Python 2.5, it is possible to pass data back into a generator function, and from Python 3.3, the information can be passed through multiple stack levels. [ 85 ]
Expressions
Some Python expressions are exchangeable to those found in languages such as C and Java, while some are not :
In Python, a differentiation between expressions and statements is rigidly enforced, in line to languages such as Common Lisp, Scheme, or Ruby. This leads to duplicating some functionality. For exemplar :
- List comprehensions vs.
for
-loops - Conditional expressions vs.
if
blocks - The
eval()
vs.exec()
built-in functions (in Python 2,exec
is a statement); the former is for expressions, the latter is for statements.
Statements can not be a region of an expression, so list and other comprehensions or lambda expressions, all being expressions, can not contain statements. A particular case of this is that an assignment statement such as a = 1
can not form separate of the conditional construction of a conditional statement. This has the advantage of avoiding a classic C error of mistaking an appointment hustler =
for an equality operator ==
in conditions : if (c = 1) { ... }
is syntactically valid ( but probably unintended ) C code but if c = 1: ...
causes a syntax mistake in Python .
Methods
Methods on objects are functions attached to the object ‘s class ; the syntax instance.method(argument)
is, for convention methods and functions, syntactic carbohydrate for Class.method(instance, argument)
. Python methods have an explicit self
parameter to access exemplify data, in contrast to the implicit self ( or this
) in some other object-oriented program languages ( for example, C++, Java, Objective-C, or Ruby ). [ 96 ] Apart from this, Python besides provides methods, often called dunder methods ( due to their names beginning and ending with double-underscores ), to allow user-defined classes to modify how they are handled by native operations such as length, comparison, in arithmetical operations, type conversion, and many more. [ 97 ]
Typing
The standard type hierarchy in Python 3 Python uses duck type and has typed objects but untyped variable star names. type constraints are not checked at compile fourth dimension ; rather, operations on an object may fail, signifying that the given object is not of a suitable type. Despite being dynamically-typed, Python is strongly-typed, forbidding operations that are not well-defined ( for example, adding a phone number to a chain ) rather than mutely attempting to make sense of them. Python allows programmers to define their own types using classes, which are most much used for object-oriented programming. New instances of classes are constructed by calling the class ( for example,
SpamClass()
or EggsClass()
), and the classes are instances of the metaclass type
( itself an example of itself ), allowing metaprogramming and mirror image. Before adaptation 3.0, Python had two kinds of classes : old-style and new-style. [ 98 ] The syntax of both styles is the same, the dispute being whether the class object
is inherited from, directly or indirectly ( all new-style classes inherit from object
and are instances of type
). In versions of Python 2 from Python 2.2 onwards, both kinds of classes can be used. Old-style classes were eliminated in Python 3.0. The long-run plan is to support gradual typing [ 99 ] and from Python 3.5, the syntax of the speech allows specifying static types but they are not checked in the default implementation, CPython. An experimental optional static type checker named mypy supports compile-time type check. [ 100 ]
Type | Mutability | Description | Syntax examples |
---|---|---|---|
bool
|
immutable | Boolean value | true false
|
bytearray
|
mutable | Sequence of bytes | bytearray ( bel 'Some ASCII ' ) bytearray ( bel `` Some ASCII '' ) bytearray ( [ 119, 105, 107, 105 ] )
|
bytes
|
immutable | Sequence of bytes | b-complex vitamin 'Some ASCII ' bel `` Some ASCII '' bytes ( [ 119, 105, 107, 105 ] )
|
complex
|
immutable | Complex number with real and imaginary parts | 3 + 2.7 joule 3 + 2.7 joule
|
dict
|
mutable | Associative array (or dictionary) of key and value pairs; can contain mixed types (keys and values), keys must be a hashable type | { 'key1 ' : 1.0, 3 : false } { }
|
types.EllipsisType
|
immutable | An ellipsis placeholder to be used as an index in NumPy arrays | ... ellipsis
|
float
|
immutable | Double-precision floating-point number. The precision is machine-dependent but in practice is generally implemented as a 64-bit IEEE 754 number with 53 bits of precision.[101] |
1.33333
|
frozenset
|
immutable | Unordered set, contains no duplicates; can contain mixed types, if hashable | frozenset ( [ 4.0, 'string ', true ] )
|
int
|
immutable | Integer of unlimited magnitude[102] | 42
|
list
|
mutable | List, can contain mixed types | [ 4.0, 'string ', truthful ]
|
types.NoneType
|
immutable | An object representing the absence of a value, often called null in other languages | none
|
types.NotImplementedType
|
immutable | A placeholder that can be returned from overloaded operators to indicate unsupported operand types. | NotImplemented
|
range
|
immutable | A Sequence of numbers commonly used for looping specific number of times in for loops[103]
|
range ( - 1, 10 ) range ( 10, - 5, - 2 )
|
set
|
mutable | Unordered set, contains no duplicates; can contain mixed types, if hashable | { 4.0, 'string ', true } sic ( )
|
str
|
immutable | A character string: sequence of Unicode codepoints | 'Flickroom ' `` Flickroom ''
`` `` '' Flickroom multiple lines '' '' '' |
tuple
|
immutable | Can contain mixed types | ( 4.0, 'string '
( 'single chemical element ', ) ( )
|
arithmetic operations
Python has the common symbols for arithmetic operators ( +
, -
, *
, /
), the floor class operator //
and the modulo operation %
( where the remainder can be negative, e.g. 4 % -3 == -2
). It besides has **
for exponentiation, e.g. 5**3 == 125
and 9**0.5 == 3.0
, and a matrix‑multiplication hustler @
. [ 104 ] These operators work like in traditional mathematics ; with the lapp precession rules, the operators infix ( +
and -
can besides be unary to represent positive and negative numbers respectively ). The part between integers produces floating-point results. The behavior of division has changed significantly over time : [ 105 ]
- Current Python (i.e. since 3.0) changed
/
to always be floating-point division, e.g.5 / 2 == 2.5
. - Python 2.2 changed integer division to round towards negative infinity, e.g.
7/3 == 2
and-7/3 == -3
. The floor division//
operator was introduced. So7//3 == 2
,-7//3 == -3
,7.5//3 == 2.0
and-7.5//3 == -3.0
. Addingfrom __future__ import division
causes a module to use Python 3.0 rules for division (see next). - Python 2.1 and earlier used C’s division behavior. The
/
operator is integer division if both operands are integers, and floating-point division otherwise. Integer division rounds towards 0, e.g.7 / 3 == 2
and- 7 / 3 == - 2
.
In Python terms, /
is true division ( or simply division ), and //
is floor division. /
before version 3.0 is classic division. [ 105 ] Rounding towards negative eternity, though unlike from most languages, adds consistency. For example, it means that the equality (a + b)//b == a//b + 1
is always true. It besides means that the equation b*(a//b) + a%b == a
is valid for both positive and damaging values of a
. however, maintaining the validity of this equation means that while the result of a%b
is, as expected, in the half-open time interval [ 0, b ), where b
is a convinced integer, it has to lie in the interval ( b, 0 ] when b
is minus. [ 106 ] Python provides a round
function for rounding a float to the nearest integer. For tie-breaking, Python 3 uses round to even : round(1.5)
and round(2.5)
both produce 2
. [ 107 ] Versions before 3 use round-away-from-zero : round(0.5)
is 1.0
, round(-0.5)
is −1.0
. [ 108 ] Python allows boolean expressions with multiple equality relations in a manner that is reproducible with general function in mathematics. For example, the construction a < b < c
tests whether a
is less than b
and b
is less than c
. [ 109 ] C-derived languages interpret this formula differently : in C, the expression would first evaluate a < b
, resulting in 0 or 1, and that result would then be compared with c
. [ 110 ] Python uses arbitrary-precision arithmetical for all integer operations. The Decimal
type/class in the decimal
module provides decimal floating-point numbers to a pre-defined arbitrary preciseness and several rounding modes. [ 111 ] The Fraction
class in the fractions
module provides arbitrary preciseness for intellectual numbers. [ 112 ] due to Python 's extensive mathematics library, and the third-party library NumPy that foster extends the native capabilities, it is frequently used as a scientific script linguistic process to help in problems such as numeral data process and handling. [ 113 ] [ 114 ]
Programming examples
Hello earth program :
print ( 'Hello, earth ! ' )
program to calculate the factorial of a positive integer :
newton = int ( input ( 'Type a number, and its factorial will be printed : ' ) ) if newton < 0 : raise ValueError ( 'You must enter a non-negative integer ' ) factorial = 1 for one in range ( 2, n + 1 ) : factorial *= iodine print ( factorial )
Libraries
Python 's big standard library, normally cited as one of its greatest strengths, [ 115 ] provides creature suited to many tasks. For Internet-facing applications, many standard formats and protocols such as MIME and HTTP are supported. It includes modules for creating graphic user interfaces, connecting to relational databases, generating pseudorandom numbers, arithmetical with arbitrary-precision decimals, [ 116 ] manipulating regular expressions, and whole examination. Some parts of the standard library are covered by specifications ( for case, the Web Server Gateway Interface ( WSGI ) implementation wsgiref
follows PEP 333 [ 117 ] ), but most modules are not. They are specified by their code, internal software documentation, and examination suites. however, because most of the standard library is cross-platform Python code, only a few modules need altering or rewriting for version implementations. As of September 2021, the Python Package Index ( PyPI ), the official depository for third-party Python software, contains over 329,000 [ 118 ] packages with a wide range of functionality, including :
Development environments
Most python implementations ( including CPython ) include a read–eval–print loop ( REPL ), permitting them to function as a command tune spokesperson for which the user enters statements consecutive and receives results immediately. Python comes with a Integrated development environment ( IDE ) called IDLE, which is more founder based. other shells, including IDLE and IPython, add far abilities such as improved auto-completion, seance state memory and syntax highlight. deoxyadenosine monophosphate well as standard background integrated development environments, there are Web browser -based IDEs ; SageMath ( intended for developing skill and math-related Python programs ) ; PythonAnywhere, a browser-based IDE and hosting environment ; and Canopy IDE, a commercial Python IDE emphasizing scientific calculate. [ 119 ]
Implementations
Reference execution
CPython is the reference execution of Python. It is written in C, meeting the C89 standard with several choice C99 features ( with later C versions out, it 's considered outdated ; [ 120 ] [ 121 ] CPython includes its own C extensions, but third-party extensions are not limited to older C versions, can e.g. be implemented with C11 or C++ [ 122 ] ). [ 123 ] It compiles Python programs into an intercede bytecode [ 124 ] which is then executed by its virtual machine. [ 125 ] CPython is distributed with a boastfully standard library written in a mixture of C and native Python. It is available for many platforms, including Windows ( starting with Python 3.9, the Python installer intentionally fails to install on Windows 7 and 8 ; [ 126 ] [ 127 ] Windows XP was supported until Python 3.5 ) and most modern Unix-like systems, including macOS ( and Apple M1 Macs, since Python 3.9.1, with experimental installer ) and unofficial accompaniment for e.g. VMS. [ 128 ] Platform portability was one of its earliest priorities, [ 129 ] during the Python 1 and Python 2 time-frame, flush OS/2 and Solaris were supported ; [ 130 ] support has since been dropped for a fortune of platforms .
other implementations
- PyPy is a fast, compliant interpreter of Python 2.7 and 3.8.[131] [132] Its just-in-time compiler brings a significant speed improvement over CPython but some libraries written in C cannot be used with it.[133]
- Stackless Python is a significant fork of CPython that implements microthreads; it does not use the call stack in the same way, thus allowing massively concurrent programs. PyPy also has a stackless version.[134]
- MicroPython and CircuitPython are Python 3 variants optimized for microcontrollers, including Lego Mindstorms EV3.[135]
- Pyston is a variant of the Python runtime that uses just-in-time compilation to speed up the execution of Python programs.[136]
- Cinder is a performance-oriented fork of CPython 3.8 that contains a number of optimizations including bytecode inline caching, eager evaluation of coroutines, a method-at-a-time JIT and an experimental bytecode compiler.[137]
unsupported implementations
other just-in-time Python compilers have been developed, but are now unsupported :
- Google began a project named Unladen Swallow in 2009, with the aim of speeding up the Python interpreter fivefold by using the LLVM, and of improving its multithreading ability to scale to thousands of cores,[138] while ordinary implementations suffer from the global interpreter lock.
- Psyco is a discontinued just-in-time specializing compiler that integrates with CPython and transforms bytecode to machine code at runtime. The emitted code is specialized for certain data types and is faster than the standard Python code. Psyco does not support Python 2.7 or later.
- PyS60 was a Python 2 interpreter for Series 60 mobile phones released by Nokia in 2005. It implemented many of the modules from the standard library and some additional modules for integrating with the Symbian operating system. The Nokia N900 also supports Python with GTK widget libraries, enabling programs to be written and run on the target device.[139]
Cross-compilers to other languages
There are respective compilers to high-level object languages, with either unrestricted Python, a restricted subset of Python, or a language similar to Python as the informant linguistic process :
operation
A operation comparison of diverse Python implementations on a non-numerical ( combinative ) workload was presented at EuroSciPy '13. [ 153 ] Python 's performance compared to other program languages is besides benchmarked by The Computer Language Benchmarks Game. [ 154 ]
Development
Python 's development is conducted largely through the Python Enhancement Proposal ( PEP ) process, the primary mechanism for proposing major new features, collecting community input signal on issues and documenting Python design decisions. [ 155 ] Python coding style is covered in PEP 8. [ 156 ] Outstanding PEPs are reviewed and commented on by the Python community and the steer council. [ 155 ] enhancement of the linguistic process corresponds with growth of the CPython reference book implementation. The mailing list python-dev is the basal forum for the terminology 's exploitation. specific issues are discussed in the Roundup hemipterous insect tracker hosted at bugs.python.org. [ 157 ] Development originally took stead on a self-hosted source-code depository running Mercurial, until Python moved to GitHub in January 2017. [ 158 ] CPython 's populace releases come in three types, distinguished by which separate of the adaptation numeral is incremented :
- Backward-incompatible versions, where code is expected to break and needs to be manually ported. The first part of the version number is incremented. These releases happen infrequently—version 3.0 was released 8 years after 2.0.
- Major or "feature" releases are largely compatible with the previous version but introduce new features. The second part of the version number is incremented. Starting with Python 3.9, these releases are expected to happen annually.[159][160] Each major version is supported by bugfixes for several years after its release.[161]
- Bugfix releases,[162] which introduce no new features, occur about every 3 months and are made when a sufficient number of bugs have been fixed upstream since the last release. Security vulnerabilities are also patched in these releases. The third and final part of the version number is incremented.[162]
many alpha, beta, and release-candidates are besides released as previews and for testing before final releases. Although there is a roughly schedule for each spill, they are often delayed if the code is not ready. Python 's growth team monitors the state of the code by running the big unit of measurement test cortege during development. [ 163 ] The major academic conference on Python is PyCon. There are besides particular Python mentor programmes, such as Pyladies. Python 3.10 deprecated wstr
( to be removed in Python 3.12 ; meaning Python extensions [ 164 ] need to be modified by then ), [ 165 ] and added traffic pattern matching to the lyric. [ 166 ]
API software documentation generators
Tools that can generate documentation for Python API include pydoc ( available as depart of standard library ), Sphinx, Pdoc and its forks, Doxygen and Graphviz, among others. [ 167 ]
Naming
Python 's name is derived from the british comedy group Monty Python, whom Python godhead Guido van Rossum enjoyed while developing the lyric. Monty Python references appear frequently in Python code and polish ; [ 168 ] for exercise, the metasyntactic variables often used in Python literature are spam and eggs rather of the traditional foo and bar. [ 168 ] [ 169 ] The official Python software documentation besides contains assorted references to Monty Python routines. [ 170 ] [ 171 ] The prefix Py- is used to show that something is related to Python. Examples of the use of this prefix in names of Python applications or libraries include Pygame, a binding of SDL to Python ( normally used to create games ) ; PyQt and PyGTK, which bind Qt and GTK to Python respectively ; and PyPy, a Python implementation in the first place written in Python .
popularity
Since 2003, Python has systematically ranked in the top ten most popular programming languages in the TIOBE Programming Community Index where, as of October 2021, it is the most popular terminology ( ahead of Java, and C ). [ 172 ] It was selected Programming Language of the Year ( for `` the highest arise in ratings in a year '' ) in 2007, 2010, 2018, and 2020 ( the only linguistic process to do indeed four times [ 173 ] ). [ 174 ] An empirical discipline found that scripting languages, such as Python, are more productive than conventional languages, such as C and Java, for programming problems involving string handling and search in a dictionary, and determined that memory pulmonary tuberculosis was frequently `` better than Java and not much worse than C or C++ ''. [ 175 ] big organizations that use Python include Flickroom, Google, [ 176 ] yahoo !, [ 177 ] CERN, [ 178 ] NASA, [ 179 ] Facebook, [ 180 ] Amazon, Instagram, [ 181 ] Flickroom [ 182 ] and some smaller entities like ILM [ 183 ] and ITA. [ 184 ] The social news networking site Reddit was written by and large in Python. [ 185 ]
Uses
Python Powered Python can serve as a script language for web applications, for example, via mod_wsgi for the Apache web server. [ 186 ] With Web Server Gateway Interface, a standard API has evolved to facilitate these applications. Web frameworks like Django, Pylons, Pyramid, TurboGears, web2py, Tornado, Flask, Bottle and Zope support developers in the design and care of complex applications. Pyjs and IronPython can be used to develop the client-side of Ajax-based applications. SQLAlchemy can be used as a data plotter to a relational database. Twisted is a framework to program communications between computers, and is used ( for example ) by Dropbox. Libraries such as NumPy, SciPy and Matplotlib allow the effective use of Python in scientific calculate, [ 187 ] [ 188 ] with speciate libraries such as Biopython and Astropy providing domain-specific functionality. SageMath is a computer algebra system with a notebook interface programmable in Python : its library covers many aspects of mathematics, including algebra, combinatorics, numeral mathematics, act hypothesis, and calculus. [ 189 ] OpenCV has Python bindings with a rich laid of features for calculator vision and image process. [ 190 ] Python is normally used in artificial intelligence projects and machine eruditeness projects with the help of libraries like TensorFlow, Keras, Pytorch and Scikit-learn. [ 191 ] [ 192 ] [ 193 ] [ 194 ] As a script speech with modular architecture, dim-witted syntax and rich people text process tools, Python is often used for natural linguistic process processing. [ 195 ] Python can besides be used to create games, with libraries such as Pygame, which can make 2D games. Python has been successfully embedded in many software products as a script linguistic process, including in finite component method software such as Abaqus, 3D parametric modeler like FreeCAD, 3D animation packages such as 3ds Max, Blender, Cinema 4D, Lightwave, Houdini, Maya, modo, MotionBuilder, Softimage, the ocular effects compositor Nuke, 2D imaging programs like GIMP, [ 196 ] Inkscape, Scribus and Paint Shop Pro, [ 197 ] and musical notation programs like scorewriter and gallinago. GNU Debugger uses Python as a pretty printer to show complex structures such as C++ containers. Esri promotes Python as the best choice for writing scripts in ArcGIS. [ 198 ] It has besides been used in several video games, [ 199 ] [ 200 ] and has been adopted as first base of the three available programming languages in Google App Engine, the other two being Java and Go. [ 201 ] many operating systems include Python as a standard component. It ships with most linux distributions, [ 202 ] AmigaOS 4 ( using Python 2.7 ), FreeBSD ( as a software ), NetBSD, OpenBSD ( as a software ) and macOS and can be used from the dominate line ( terminal ). many Linux distributions use installers written in Python : Ubuntu uses the Ubiquity installer, while Red Hat Linux and Fedora Linux use the Anaconda installer. Gentoo Linux uses Python in its box management arrangement, Portage. Python is used extensively in the data security industry, including in feat development. [ 203 ] [ 204 ] Most of the Sugar software for the One Laptop per Child XO, now developed at Sugar Labs, is written in Python. [ 205 ] The Raspberry Pi single-board calculator project has adopted Python as its independent user-programming speech. LibreOffice includes Python, and intends to replace Java with Python. Its Python Scripting Provider is a core have [ 206 ] since Version 4.0 from 7 February 2013 .
Languages influenced by Python
Python 's blueprint and doctrine have influenced many other programming languages :
- Boo uses indentation, a similar syntax, and a similar object model.[207]
- Cobra uses indentation and a similar syntax, and its Acknowledgements document lists Python first among languages that influenced it.[208]
- CoffeeScript, a programming language that cross-compiles to JavaScript, has Python-inspired syntax.
- ECMAScript/JavaScript borrowed iterators and generators from Python.[209]
- GDScript, a scripting language very similar to Python, built-in to the Godot game engine.[210]
- Go is designed for the "speed of working in a dynamic language like Python"[211] and shares the same syntax for slicing arrays.
- Groovy was motivated by the desire to bring the Python design philosophy to Java.[212]
- Julia was designed to be "as usable for general programming as Python".[27]
- Nim uses indentation and similar syntax.[213]
- Ruby's creator, Yukihiro Matsumoto, has said: "I wanted a scripting language that was more powerful than Perl, and more object-oriented than Python. That's why I decided to design my own language."[214]
- Swift, a programming language developed by Apple, has some Python-inspired syntax.[215]
Python 's development practices have besides been emulated by other languages. For case, the practice of requiring a document describing the rationale for, and issues surrounding, a change to the language ( in Python, a PEP ) is besides used in Tcl, [ 216 ] Erlang, [ 217 ] and Swift. [ 218 ]