Jump to content

2: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
Tag: nowiki added
Line 1: Line 1:
{{Use dmy dates|date=February 2015}}
{{Redirect10|II|Two|Number 2}}
{{Infobox number
{{Infobox programming language
|name = Python
| number = 2
|logo = Python logo and wordmark.svg
| ordinal = 2nd (second / [[wikt:twoth|twoth]])
|logo_size = 260px
| numeral = [[binary numeral system|binary]]
|paradigm = [[multi-paradigm programming language|multi-paradigm]]: [[object-oriented programming|object-oriented]], [[imperative programming|imperative]], [[functional programming|functional]], [[procedural programming|procedural]], [[reflective programming|reflective]]
| factorization = [[prime number|prime]]
|year = {{Start date and age|df=yes|1991}}
| gaussian integer factorization = <math>(1 + i)(1 - i)</math>
|designer = [[Guido van Rossum]]
| prime = 1st
|developer = [[Python Software Foundation]]
| divisor = 1, 2
|latest_release_version = 3.4.3 /<br>{{Start date|df=yes|2015|02|25}}<ref>{{cite web |url=https://docs.python.org/3.4/whatsnew/changelog.html#python-3-4-3 |title=Python 3.4.3 |publisher=Python Software Foundation |accessdate=27 February 2015}}</ref><br>2.7.10 /<br>{{Start date|df=yes|2015|05|23}}<ref name="">{{cite web |url=https://www.python.org/downloads/release/python-2710/ |title=Python 2.7.10 Release |publisher=Python Software Foundation |accessdate=24 May 2015}}</ref>
| roman unicode = Ⅱ, ⅱ
|latest_preview_version = 3.5.0b3 /<br>{{Start date|df=yes|2015|07|05}}<ref name="Python Release Python 3.5.0b2">{{cite web |url=https://www.python.org/downloads/release/python-350b3/ |title=Python Release Python 3.5.0b3 |publisher=Python Software Foundation |accessdate=9 July 2015}}</ref><!-- br>2.7.9rc1 /<br>{{Start date|df=yes|2014|11|26}}<ref>{{cite web |url=https://www.python.org/downloads/release/python-279rc1/ |title=Python 2.7.9 rc1 Release |publisher=Python Software Foundation |accessdate=26 November 2014}}</ref -->
| greek prefix = [[Wiktionary:di-|di-]]
|typing = [[duck typing|duck]], [[dynamic typing|dynamic]], [[strong typing|strong]], [[gradual typing|gradual]] (as of Python 3.5)<ref>{{cite web|url=https://lwn.net/Articles/627418/|title=Type hinting for Python|publisher=LWN.net|date=2014-12-24|accessdate=2015-05-05}}</ref>
| latin prefix = [[Wiktionary:duo-|duo-]] [[Wiktionary:bi-|bi-]]
|implementations = [[CPython]], [[IronPython]], [[Jython]], [[PyPy]]
| old english prefix = [[Wiktionary:twi-|twi-]]
|dialects = [[Cython]], [[RPython]], [[Stackless Python]]
| lang1 = [[Greek numeral]]
|influenced_by = [[ABC (programming language)|ABC]],<ref name="faq-created"/> [[ALGOL 68]],<ref name="98-interview"/> [[C (programming language)|C]],<ref name="AutoNT-1"/> [[C++]],<ref name="classmix"/> [[Dylan (programming language)|Dylan]],<ref name="AutoNT-2"/> [[Haskell (programming language)|Haskell]],<ref name="AutoNT-3"/> [[Icon (programming language)|Icon]],<ref name="AutoNT-4"/> [[Java (programming language)|Java]],<ref name="AutoNT-5"/> [[Lisp (programming language)|Lisp]],<ref name="AutoNT-6"/> [[Modula-3]],<ref name="classmix" /> [[Perl]]
| lang1 symbol = β'
|influenced = [[Boo (programming language)|Boo]], [[Cobra (programming language)|Cobra]], [[D (programming language)|D]], [[F Sharp (programming language)|F#]], [[Falcon (programming language)|Falcon]], [[Go (programming language)|Go]], [[Groovy (programming language)|Groovy]], [[JavaScript]],<ref>{{cite web
| lang2 = [[Eastern Arabic numerals|Arabic]]
|title = Perl and Python influences in JavaScript
| lang2 symbol = {{resize|150%|٢}}
|date= 24 February 2013
| lang3 = [[Urdu]]
|website= {{URL|http://www.2ality.com/}}
| lang3 symbol = {{Urdu numeral|2|20}}
|url= http://www.2ality.com/2013/02/javascript-influences.html
| lang4 = [[Ge'ez alphabet|Ge'ez]]
|accessdate= 15 May 2015}}</ref><ref>{{cite web
| lang4 symbol = ፪
|title = Chapter 3: Tha Nature of JavaScript; Influences
| lang5 = [[Bengali numerals|Bengali]]
|last=Rauschmayer
| lang5 symbol = {{resize|150%|২}}
|first=Axel
| lang6 = [[Chinese numeral]]
|website=O'Reilly, Speaking JavaScript
| lang6 symbol = 二,弍,贰,貳
|url= http://speakingjs.com/es5/ch03.html
| lang7 = [[Devanāgarī]]
|accessdate= 15 May 2015}}</ref> [[Julia (programming language)|Julia]],<ref>{{cite web| title = Why We Created Julia| date= February 2012| website= Julia website| url= http://julialang.org/blog/2012/02/why-we-created-julia/| accessdate= 5 June 2014}}</ref> [[Nim (programming language)|Nim]], [[Ruby (programming language)|Ruby]],<ref name="bini"/> [[Swift (Apple programming language)|Swift]]<ref name="lattner2014">{{cite web|url=http://nondot.org/sabre/|title=Chris Lattner's Homepage|last=Lattner|first=Chris|date=3 June 2014|accessdate=3 June 2014|publisher=Chris Lattner|quote=The Swift language is the product of tireless effort from a team of language experts, documentation gurus, compiler optimization ninjas, and an incredibly important internal dogfooding group who provided feedback to help refine and battle-test ideas. Of course, it also greatly benefited from the experiences hard-won by many other languages in the field, drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list.}}</ref>
| lang7 symbol = {{resize|150%|२}} (do)
|operating_system = [[Cross-platform]]
| lang8 = [[Indian numerals#Telugu numerals and their names|Telugu]]
|license = [[Python Software Foundation License]]
| lang8 symbol = {{resize|150%|౨}}
|website = {{URL|https://www.python.org/}}
| lang9 = [[Tamil numerals|Tamil]]
|file_ext = .py, .pyc, .pyd, .pyo, .pyw
| lang9 symbol = {{resize|150%|௨}}
|wikibooks = Python Programming
| lang10 = [[Hebrew numerals|Hebrew]]
| lang10 symbol = {{resize|150%|ב}} (Bet)
| lang11 = [[Khmer numerals|Khmer]]
| lang11 symbol = ២
| lang12 = [[Korean numerals|Korean]]
| lang12 symbol = 이,둘
| lang13 = [[Thai numerals|Thai]]
| lang13 symbol = ๒
}}
}}
'''2''' ('''Two'''; {{IPAc-en|audio=En-us-two.ogg|ˈ|t|uː}}) is a [[number]], [[numeral system|numeral]], and [[glyph]]. It is the [[natural number]] following [[1 (number)|1]] and preceding [[3 (number)|3]].


'''Python''' is a widely used [[general-purpose programming language|general-purpose]], [[high-level programming language]].<ref name="AutoNT-34" /><ref>{{cite web|url=http://radar.oreilly.com/2006/08/programming-language-trends.html|title=Programming Language Trends - O'Reilly Radar|publisher=Radar.oreilly.com|date=2 August 2006|accessdate=17 July 2013}}</ref><ref>{{cite web|url=http://redmonk.com/sogrady/2013/02/28/language-rankings-1-13/|title=The RedMonk Programming Language Rankings: January 2013 – tecosystems|publisher=Redmonk.com|date=28 February 2013|accessdate=17 July 2013}}</ref> Its design philosophy emphasizes code [[readability]], and its syntax allows programmers to express concepts in fewer [[lines of code]] than would be possible in languages such as [[C++]] or [[Java (programming language)|Java]].<ref name="Summerfield">{{cite book |title=Rapid GUI Programming with Python and Qt |last=Summerfield |first=Mark |quote=Python is a very expressive language, which means that we can usually write far fewer lines of Python code than would be required for an equivalent application written in, say, C++ or Java}}</ref><ref>{{cite book|url=http://books.google.com/books?id=3JfE7TGUwvgC&pg=PT100|title=Code Complete, p. 100|isbn=9780735636972|last1=McConnell|first1=Steve|date=30 November 2009}}</ref> The language provides constructs intended to enable clear programs on both a small and large scale.<ref name="AutoNT-7" />
==In mathematics==
The number two has many properties in [[mathematics]].<ref>Wells, D. ''[[The Penguin Dictionary of Curious and Interesting Numbers]]'' London: Penguin Group. (1987): 41–44</ref> An [[integer]] is called ''[[Parity (mathematics)|even]]'' if it is divisible by 2. For integers written in a numeral system based on an even number, such as [[decimal]] and [[hexadecimal]], divisibility by 2 is easily tested by merely looking at the last digit. If it is even, then the whole number is even. In particular, when written in the decimal system, all multiples of 2 will end in 0, 2, 4, 6, or 8.


Python supports multiple [[programming paradigm]]s, including [[object-oriented programming|object-oriented]], [[imperative programming|imperative]] and [[functional programming]] or [[procedural programming|procedural]] styles. It features a [[dynamic type]] system and automatic [[memory management]] and has a large and comprehensive [[standard library]].<ref name="About" />
Two is the smallest and the first [[prime number]], and the only even prime number <ref>Bryan Bunch, ''The Kingdom of Infinite Number''. New York: W. H. Freeman & Company (2000): 31</ref> (for this reason it is sometimes called "the oddest prime").<ref>John Horton Conway & Richard K. Guy, ''The Book of Numbers''. New York: Springer (1996): 25. ISBN 0-387-97993-X. "Two is celebrated as the only even prime, which in some sense makes it the oddest prime of all."</ref> The next prime is [[3 (number)|three]]. Two and three are the only two consecutive prime numbers. 2 is the first [[Sophie Germain prime]], the first [[factorial prime]], the first [[Lucas prime]], the first [[Ramanujan prime]], and the first [[Smarandache-Wellin prime]]. It is an [[Eisenstein prime]] with no imaginary part and real part of the form <math>3n - 1</math>. It is also a [[Stern prime]], a [[Pell number]], the first [[Fibonacci prime]], and a [[Markov number]]—appearing in infinitely many solutions to the Markov Diophantine equation involving odd-indexed Pell numbers.


Python interpreters are available for installation on many operating systems, allowing Python code execution on a wide variety of systems. Using [[Third-party software component|third-party]] tools, such as [[Py2exe]] or Pyinstaller,<ref>{{cite web|title=PyInstaller Home Page|url=http://www.pyinstaller.org/|accessdate=27 January 2014}}</ref> Python code can be packaged into stand-alone executable programs for some of the most popular operating systems, allowing for the distribution of Python-based software for use on those environments without requiring the installation of a Python interpreter.
It is the third [[Fibonacci number]], and the third and fifth [[Perrin number]]s.


[[CPython]], the [[reference implementation]] of Python, is [[free and open-source software]] and has a community-based development model, as do nearly all of its alternative implementations. CPython is managed by the non-profit [[Python Software Foundation]].
Despite being prime, two is also a [[superior highly composite number]], because it is a natural number which has more divisors than any other number scaled relative to the number itself. The next superior highly composite number is [[6 (number)|six]].


[[Vulgar fraction]]s with only 2 or 5 in the [[denominator]] do not yield infinite [[Decimal representation|decimal expansions]], as is the case with all other primes, because 2 and 5 are [[Divisor|factors]] of [[10 (number)|ten]], the decimal base.


== History ==
Two is the [[radix|base]] of the simplest [[numeral system]] in which natural numbers can be written concisely, being the length of the number a logarithm of the value of the number (whereas in base 1 the length of the number is the value of the number itself); the binary system is used in [[computer]]s.
[[File:Guido van Rossum OSCON 2006.jpg|thumb|[[Guido van Rossum]], the creator of Python.]]
{{Main|History of Python}}


Python was conceived in the late 1980s<ref name="venners-interview-pt-1" /> and its implementation was started in December 1989<ref name="timeline-of-python" /> by [[Guido van Rossum]] at [[Centrum Wiskunde & Informatica|CWI]] in the [[Netherlands]] as a successor to the [[ABC (programming language)|ABC language]] (itself inspired by [[SETL]])<ref name="AutoNT-12" /> capable of [[exception handling]] and interfacing with the [[Amoeba (operating system)|Amoeba operating system]].<ref name="faq-created" /> Van Rossum is Python's principal author, and his continuing central role in deciding the direction of Python is reflected in the title given to him by the Python community, ''[[benevolent dictator for life]]'' (BDFL).
For any number ''x'':
:''x''+''x'' = 2·''x'' [[addition]] to [[multiplication]]
:''x''·''x'' = ''x''<sup>2</sup> [[multiplication]] to [[exponentiation]]
:''x''<sup>''x''</sup> = ''x''↑↑2 [[exponentiation]] to [[tetration]]


About the origin of Python, Van Rossum wrote in 1996:<ref>{{cite web|url=https://www.python.org/doc/essays/foreword/|title=Foreword for "Programming Python" (1st ed.)|last=van Rossum|first=Guido|date=1996|accessdate=10 July 2014}}</ref>
In general:


{{quote|Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office ... would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of [[ABC (programming language)|ABC]] that would appeal to [[Unix]]/[[C (programming language)|C]] [[Hacker (programmer subculture)|hackers]]. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of ''[[Monty Python's Flying Circus]]'').}}
:hyper(''x'',n,''x'') = hyper(''x'',n+1,2)


Python 2.0 was released on 16 October 2000, and included many major new features including a full [[garbage collection (computer science)|garbage collector]] and support for [[Unicode]]. With this release the development process was changed and became more transparent and community-backed.<ref name="newin-2.0" />
Two also has the unique property that 2+2 = 2·2 = 2²=''2''↑↑2=''2''↑↑↑2, and so on, no matter how high the level of the [[hyperoperation]] is.


Python 3.0 (also called Python 3000 or py3k), a major, backwards-incompatible release, was released on 3 December 2008<ref name="3.0-release" /> after a long period of testing. Many of its major features have been [[backporting|backported]] to the backwards-compatible Python 2.6 and 2.7.<ref name="pep-3000" />
Two is the only number ''x'' such that the sum of the reciprocals of the powers of ''x'' equals itself. In symbols


== Features and philosophy ==
:<math>\sum_{k=0}^{\infin}\frac {1}{2^k}=1+\frac{1}{2}+\frac{1}{4}+\frac{1}{8}+\frac{1}{16}+\cdots=2.</math>
Python is a [[multi-paradigm programming language]]: [[object-oriented programming]] and [[structured programming]] are fully supported, and there are a number of language features which support [[functional programming]] and [[aspect-oriented programming]] (including by [[metaprogramming]]<ref name="AutoNT-13" /> and by [[magic methods]]).<ref name="AutoNT-14" /> Many other paradigms are supported using extensions, including [[design by contract]]<ref name="AutoNT-15" /><ref name="AutoNT-16" /> and [[logic programming]].<ref name="AutoNT-17" />


Python uses [[dynamic typing]] and a combination of [[reference counting]] and a cycle-detecting [[garbage collection (computer science)|garbage collector]] for [[memory management]]. An important feature of Python is dynamic [[name resolution]] ([[late binding]]), which binds method and variable names during program execution.
This comes from the fact that:


The design of Python offers some support for [[functional programming]] in the [[Lisp (programming language)|Lisp]] tradition. The language has map(), reduce() and filter() functions; [[list comprehension|comprehensions]] for lists, [[Associative array|dictionaries]], and sets; and [[Generator (computer programming)|generator]] expressions.<ref name="AutoNT-59"/> The standard library has two modules (itertools and functools) that implement functional tools borrowed from [[Haskell (programming language)|Haskell]] and [[Standard ML]].<ref name="AutoNT-18" />
:<math>\sum_{k=0}^\infin \frac {1}{n^k}=1+\frac{1}{n-1} \quad\mbox{for all} \quad n\in\mathbb R > 1.</math>


The core philosophy of the language is summarized by the document "PEP 20 (The Zen of Python)", which includes [[aphorism]]s such as:<ref name="PEP20" />
[[Power of two|Powers of two]] are central to the concept of [[Mersenne prime]]s, and important to [[computer science]]. Two is the first Mersenne prime exponent.
* Beautiful is better than ugly
* Explicit is better than implicit
* Simple is better than complex
* Complex is better than complicated
* Readability counts


Rather than requiring all desired functionality to be built into the language's core, Python was designed to be highly extensible. Python can also be embedded in existing applications that need a programmable interface. This design of a small core language with a large standard library and an easily extensible interpreter was intended by Van Rossum from the very start because of his frustrations with [[ABC (programming language)|ABC]] (which espoused the opposite mindset).<ref name="venners-interview-pt-1" />
Taking the [[square root]] of a number is such a common mathematical operation, that the spot on the root sign where the exponent would normally be written for cubic roots and other such roots, is left blank for square roots, as it is considered tacit.


While offering choice in coding methodology, the Python philosophy rejects exuberant syntax, such as in [[Perl]], in favor of a sparser, less-cluttered grammar. As [[Alex Martelli]] put it: "To describe something as clever is ''not'' considered a compliment in the Python culture."<ref name="AutoNT-19" /> Python's philosophy rejects the Perl "[[there is more than one way to do it]]" approach to language design in favor of "there should be one—and preferably only one—obvious way to do it".<ref name="PEP20" />
The [[square root of 2]] was the first known [[irrational number]].


Python's developers strive to avoid [[premature optimization]], and moreover, reject patches to non-critical parts of CPython which would offer a marginal increase in speed at the cost of clarity.<ref name="AutoNT-20" /> When speed is important, Python programmers use [[PyPy]], a [[just-in-time compilation|just-in-time compiler]], or move time-critical functions to extension modules written in languages such as C. [[Cython]] is also available which translates a Python script into C and makes direct C level API calls into the Python interpreter.
The smallest [[field (mathematics)|field]] has two elements.


An important goal of the Python developers is making Python fun to use. This is reflected in the origin of the name which comes from [[Monty Python]],<ref>{{cite web|url=https://docs.python.org/2/faq/general.html#why-is-it-called-python|title=General Python FAQ - Why is it called Python?}}</ref> and in an occasionally playful approach to tutorials and reference materials, such as using examples that refer to spam and eggs instead of the standard [[Foobar|foo and bar]].<ref>{{cite web|url=http://insidetech.monster.com/training/articles/8114-15-ways-python-is-a-powerful-force-on-the-web|title=15 Ways Python Is a Powerful Force on the Web}}</ref><ref>{{cite web|url=https://docs.python.org/2/library/pprint.html|title=pprint - Data pretty printer - Python Documentation}}</ref>
In the [[set theory|set-theoretical]] construction of the natural numbers, 2 is identified with the set <math>\{\{\emptyset\},\emptyset\}</math>. This latter set is important in [[category theory]]: it is a [[subobject classifier]] in the category of sets.


A common [[neologism]] in the Python community is ''pythonic'', which can have a wide range of meanings related to program style. To say that code is pythonic is to say that it uses Python idioms well, that it is natural or shows fluency in the language, that it conforms with Python's minimalist philosophy and emphasis on readability. In contrast, code that is difficult to understand or reads like a rough transcription from another programming language is called ''unpythonic''.
Two is a [[primorials|primorial]], as well as its own [[factorial]]. Two often occurs in numerical sequences, such as the [[Fibonacci numbers|Fibonacci number]] sequence, but not quite as often as one does. Two is also a [[Motzkin number]], a [[Bell number]], an [[Harshad number|all-Harshad number]], a [[meandric number]], a [[semi-meandric number]], and an [[open meandric number]].


Users and admirers of Python—especially those considered knowledgeable or experienced—are often referred to as ''Pythonists'', ''Pythonistas'', and ''Pythoneers''.<ref name="AutoNT-27" /><ref name="AutoNT-25" />
Two is the number of [[Eight queens puzzle|n-Queens Problem]] solutions for n = 4. With one exception, all known solutions to [[Znám's problem]] start with 2.


== Syntax and semantics ==
Two also has the unique property such that
{{Main|Python syntax and semantics}}


Python is intended to be a highly readable language. It is designed to have an uncluttered visual layout, frequently using English keywords where other languages use punctuation. Furthermore, Python has a smaller number of syntactic exceptions and special cases than [[C (programming language)|C]] or [[Pascal (programming language)|Pascal]].<ref name="AutoNT-52" />
:<math>\sum_{k=0}^{n-1} 2^k = 2^{n} - 1</math>


=== Indentation ===
and also
{{Main|Python syntax and semantics#Indentation}}


Python uses [[whitespace character|whitespace]] indentation, rather than [[curly bracket programming language|curly braces]] or keywords, to delimit [[block (programming)|blocks]]; this feature is also termed the [[off-side rule]]. An increase in indentation comes after certain statements; a decrease in indentation signifies the end of the current block.<ref name="AutoNT-53" />
:<math>\sum_{k=a}^{n-1} 2^k = 2^n - \sum_{k=0}^{a-1} 2^k - 1</math>
for ''a'' not equal to zero


=== Statements and control flow ===
The number of domino tilings of a 2×2 [[checkerboard]] is 2.
Python's statements include (among others):
* The [[if-then-else|<code>if</code> statement]], which conditionally executes a block of code, along with <code>else</code> and <code>elif</code> (a contraction of else-if).
* The [[Foreach#Python|<code>for</code> statement]], which iterates over an iterable object, capturing each element to a local variable for use by the attached block.
* The [[While loop#Python|<code>while</code> statement]], which executes a block of code as long as its condition is true.
* The [[Exception handling syntax#Python|<code>try</code>]] statement, which allows exceptions raised in its attached code block to be caught and handled by <code>except</code> clauses; it also ensures that clean-up code in a <code>finally</code> block will always be run regardless of how the block exits.
* The <code>class</code> statement, which executes a block of code and attaches its local namespace to a [[class (computer science)|class]], for use in [[object-oriented programming]].
* The <code>def</code> statement, which defines a [[function (computing)|function]] or [[method (computing)|method]].
* The <code>with</code> statement (from Python 2.5), which encloses a code block within a context manager (for example, acquiring a [[lock (computer science)|lock]] before the block of code is run and releasing the lock afterwards, or opening a [[Computer file|file]] and then closing it), allowing [[Resource Acquisition Is Initialization|RAII]]-like behavior.
* The <code>pass</code> statement, which serves as a [[NOP]]. It is syntactically needed to create an empty code block.
* The [[assertion (programming)|<code>assert</code> statement]], used during debugging to check for conditions that ought to apply.
* The <code>yield</code> statement, which returns a value from a [[generator (computer science)#Python|generator]] function. From Python 2.5, <code>yield</code> is also an operator. This form is used to implement [[coroutine]]s.
* The <code>import</code> statement, which is used to import modules whose functions or variables can be used in the current program.
* The <code>print</code> statement was changed to the <code>print()</code> function in Python 3.<ref name="diff_py2-3">{{cite book|last=Sweigart|first=Al|year=2010|chapter=Appendix A: Differences Between Python 2 and 3|title=Invent Your Own Computer Games with Python|url=http://inventwithpython.com/appendixa.html|edition=2|isbn=978-0-9821060-1-3|accessdate=20 February 2014}}</ref>


Python does not support [[Tail call|tail-call optimization]] or [[first-class continuations]], and, according to Guido van Rossum, it never will.<ref name="AutoNT-55" /><ref name="AutoNT-56" /> However, better support for [[coroutine]]-like functionality is provided in 2.5, by extending Python's [[generator (computer science)|generators]].<ref name="AutoNT-57" /> Prior to 2.5, generators were [[lazy evaluation|lazy]] [[iterator]]s; information was passed unidirectionally out of the generator. As of Python 2.5, it is possible to pass information back into a generator function, and as of Python 3.3, the information can be passed through multiple stack levels.<ref name="AutoNT-58" />
In [[Dimension (mathematics and physics)|''n''-dimensional space]] for any ''n'', any two distinct [[point (geometry)|points]] determine a [[line (geometry)|line]].


=== Expressions ===
For any polyhedron homeomorphic to a sphere, the [[Euler characteristic]] is
Python expressions are similar to languages such as [[C (programming language)|C]] and [[Java (programming language)|Java]]:
:<math>\chi = V-E+F = 2,\ </math>
* Addition, subtraction, and multiplication are the same, but the behavior of division differs (see [[#Mathematics|Mathematics]] for details). Python also added the <code>**</code> operator for exponentiation.
where ''V'' is the number of [[Vertex (geometry)|vertices]], ''E'' is the number of [[Edge (geometry)|edge]]s, and ''F'' is the number of [[Face (geometry)|face]]s.
* In Python, <code>==</code> compares by value, in contrast to Java, where it compares by reference. (Value comparisons in Java use the <code>equals()</code> method.) Python's <code>is</code> operator may be used to compare object identities (comparison by reference). Comparisons may be chained, for example <code>a <= b <= c</code>.
* Python uses the words <code>and</code>, <code>or</code>, <code>not</code> for its boolean operators rather than the symbolic <code>&&</code>, <code>||</code>, <code>!</code> used in Java and C.
* Python has a type of expression termed a ''[[list comprehension#Python|list comprehension]]''. Python 2.4 extended list comprehensions into a more general expression termed a ''[[generator (computer science)|generator]] expression''.<ref name="AutoNT-59" />
* [[Anonymous function]]s are implemented using [[Lambda (programming)|lambda expressions]]; however, these are limited in that the body can only be a single expression.
* Conditional expressions in Python are written as <code>x if c else y</code><ref name="AutoNT-60" /> (different in order of operands from the <code>[[?:]]</code> operator common to many other languages).
* Python makes a distinction between [[list (computer science)|lists]] and [[tuple]]s. Lists are written as <code>[1, 2, 3]</code>, are mutable, and cannot be used as the keys of dictionaries (dictionary keys must be [[immutable]] in Python). Tuples are written as <code>(1, 2, 3)</code>, are immutable and thus can be used as the keys of dictionaries, provided all elements of the tuple are immutable. The parentheses around the tuple are optional in some contexts. Tuples can appear on the left side of an equal sign; hence a statement like <code>x, y = y, x</code> can be used to swap two variables.
* Python has a "string format" operator <code>%</code>. This functions analogous to <code>[[printf]]</code> format strings in [[C (programming language)|C]], e.g. <code>"foo=%s bar=%d" % ("blah", 2)</code> evaluates to <code>"foo=blah bar=2"</code>. In Python 3 and 2.6+, this was supplemented by the <code>format()</code> method of the <code>str</code> class, e.g. <code>"foo={0} bar={1}".format("blah", 2)</code>.
* Python has various kinds of [[string literal]]s:
** Strings delimited by single or double quotation marks. Unlike in [[Unix shell]]s, [[Perl]] and Perl-influenced languages, single quotation marks and double quotation marks function identically. Both kinds of string use the backslash (<code>\</code>) as an [[escape character]] and there is no implicit [[string interpolation]] such as <code>"$foo"</code>.
** Triple-quoted strings, which begin and end with a series of three single or double quotation marks. They may span multiple lines and function like [[here document]]s in shells, Perl and [[Ruby (programming language)|Ruby]].
** [[Raw string]] varieties, denoted by prefixing the string literal with an <code>r</code>. No escape sequences are interpreted; hence raw strings are useful where literal backslashes are common, such as [[regular expression]]s and [[Microsoft Windows|Windows]]-style paths. Compare "<code>@</code>-quoting" in [[C Sharp (programming language)|C#]].
* Python has [[array index|index]] and [[array slicing|slice]] expressions on lists, denoted as <code>a[key]</code>, <code>a[start:stop]</code> or <code>a[start:stop:step]</code>. Indexes are [[zero-based]], and negative indexes are relative to the end. Slices take elements from the ''start'' index up to, but not including, the ''stop'' index. The third slice parameter, called ''step'' or ''stride'', allows elements to be skipped and reversed. Slice indexes may be omitted, for example <code>a[:]</code> returns a copy of the entire list. Each element of a slice is a [[shallow copy]].


In Python, a distinction between expressions and statements is rigidly enforced, in contrast to languages such as [[Common Lisp]], [[Scheme (programming language)|Scheme]], or [[Ruby (programming language)|Ruby]]. This leads to some duplication of functionality. For example:
As of Jun. 2015, there are only two known [[Wieferich prime]]s in [[base 2]].
* [[List comprehensions]] vs. <code>for</code>-loops
* [[Conditional (programming)|Conditional]] expressions vs. <code>if</code> blocks
* The <code>eval()</code> vs. <code>exec()</code> built-in functions (in Python 2, <code>exec</code> is a statement); the former is for expressions, the latter is for statements.


Statements cannot be a part of an expression, so list and other comprehensions or [[Lambda (programming)|lambda expressions]], all being expressions, cannot contain statements. A particular case of this is that an assignment statement such as <code>a = 1</code> cannot form part of the conditional expression of a conditional statement. This has the advantage of avoiding a classic C error of mistaking an assignment operator <code>=</code> for an equality operator <code>==</code> in conditions: <code>if (c = 1) { ... }</code> is valid C code but <code>if c = 1: ...</code> causes a syntax error in Python.
With the exception of the sequence 3, 5, 7, the maximum number of [[twin prime|consecutive odd numbers that are prime]] is two.


===List of basic calculations===
=== Methods ===
[[Method (programming)|Methods]] on objects are [[function (programming)|functions]] attached to the object's class; the syntax <code>instance.method(argument)</code> is, for normal methods and functions, [[syntactic sugar]] for <code>Class.method(instance, argument)</code>. Python methods have an explicit <code>[[this (computer programming)|self]]</code> parameter to access [[instance data]], in contrast to the implicit <code>self</code> (or <code>this</code>) in some other object-oriented programming languages (e.g. [[C++]], [[Java (programming language)|Java]], [[Objective-C]], or [[Ruby (programming language)|Ruby]]).<ref name="AutoNT-61" />
{|class="wikitable" style="text-align: center; background: white"

=== Typing ===
Python uses [[duck typing]] and has typed objects but untyped variable names. Type constraints are not checked at [[compile time]]; rather, operations on an object may fail, signifying that the given object is not of a suitable type. Despite being [[dynamic programming language|dynamically typed]], Python is [[strongly typed programming language|strongly typed]], forbidding operations that are not well-defined (for example, adding a number to a string) rather than silently attempting to make sense of them.

Python allows programmers to define their own types using [[class (computer science)|classes]], which are most often used for [[object-oriented programming]]. New [[object (computer science)|instances]] of classes are constructed by calling the class (for example, <code>SpamClass()</code> or <code>EggsClass()</code>), and the classes themselves are instances of the [[metaclass]] <code>type</code> (itself an instance of itself), allowing [[metaprogramming]] and [[reflection (computer science)|reflection]].

Prior to version 3.0, Python had two kinds of classes: "old-style" and "new-style".<ref name="classy" /> Old-style classes were eliminated in Python 3.0, making all classes new-style. In versions between 2.2 and 3.0, both kinds of classes could be used. The syntax of both styles is the same, the difference being whether the class <code>object</code> is inherited from, directly or indirectly (all new-style classes inherit from <code>object</code> and are instances of <code>type</code>).

{|class="wikitable"
|+Summary of Python 3's built-in types
|-
|-
! Type
!width="105px"|[[Multiplication]]
! Description
!1
! Syntax example
!2
!3
!4
!5
!6
!7
!8
!9
!10
!11
!12
!13
!14
!15
!16
!17
!18
!19
!20
!21
!22
!23
!24
!25
!width="5px"|
!50
!100
!1000
|-
|-
|<math>2 \times x</math>
| <code>str</code>
| A [[character string]]: an [[Immutable object|immutable]] sequence of Unicode codepoints.
|'''2'''
| <code>'Wikipedia'</code><br><code>"Wikipedia"</code><br><code>"""Spanning<br>multiple<br>lines"""</code>
|[[4 (number)|4]]
|[[6 (number)|6]]
|[[8 (number)|8]]
|[[10 (number)|10]]
|[[12 (number)|12]]
|[[14 (number)|14]]
|[[16 (number)|16]]
|[[18 (number)|18]]
|[[20 (number)|20]]
|[[22 (number)|22]]
|[[24 (number)|24]]
|[[26 (number)|26]]
|[[28 (number)|28]]
|[[30 (number)|30]]
|[[32 (number)|32]]
|[[34 (number)|34]]
|[[36 (number)|36]]
|[[38 (number)|38]]
|[[40 (number)|40]]
|[[42 (number)|42]]
|[[44 (number)|44]]
|[[46 (number)|46]]
|[[48 (number)|48]]
|[[50 (number)|50]]
!
|[[100 (number)|100]]
|[[200 (number)|200]]
|[[2000 (number)|2000]]
|}

{|class="wikitable" style="text-align: center; background: white"
|-
|-
| <code>bytearray</code>
!width="105px"|[[Division (mathematics)|Division]]
| A mutable sequence of [[byte]]s.
!1
| <code>bytearray(b'Some ASCII')</code><br><code>bytearray(b"Some ASCII")</code><br><code>bytearray([119, 105, 107, 105])</code>
!2
!3
!4
!5
!6
!7
!8
!9
!10
!11
!12
!13
!14
!15
|-
|-
|<math>2 \div x</math>
| <code>bytes</code>
| An immutable sequence of bytes.
|'''2'''
| <code>b'Some ASCII'</code><br><code>b"Some ASCII"</code><br><code>bytes([119, 105, 107, 105])</code>
|1
|0.{{overline|6}}
|[[one half|0.5]]
|0.4
|0.{{overline|3}}
|0.{{overline|285714}}
|[[4 (number)|0.25]]
|0.{{overline|2}}
|0.2
|0.{{overline|18}}
|0.1{{overline|6}}
|0.{{overline|153846}}
|0.{{overline|142857}}
|0.1{{overline|3}}
|-
|-
|<math>x \div 2</math>
| <code>list</code>
| Mutable [[list (computer science)|list]], can contain mixed types.
|0.5
| <code>[4.0, 'string', True]</code>
|1
|1.5
|'''2'''
|2.5
|3
|3.5
|4
|4.5
|5
|5.5
|6
|6.5
|[[7 (number)|7]]
|7.5
|}

{|class="wikitable" style="text-align: center; background: white"
|-
|-
| <code>tuple</code>
!width="105px"|[[Exponentiation]]
| Immutable, can contain mixed types.
!1
| <code>(4.0, 'string', True)</code>
!2
!3
!4
!5
!6
!7
!8
!9
!10
!11
!12
!13
!14
|-
|-
| <code>set</code>, <code>frozenset</code>
|<math>2 ^ x\,</math>
| Unordered [[set (computer science)|set]], contains no duplicates.<br>A <code>frozenset</code> is immutable.<br>Either can contain mixed types as long as they are hashable.
|'''2'''
| <code>{4.0, 'string', True}</code><br><code>frozenset([4.0, 'string', True])</code>
|4
|8
|16
|32
|[[64 (number)|64]]
|[[128 (number)|128]]
|[[256 (number)|256]]
|[[512 (number)|512]]
|[[1024 (number)|1024]]
|2048
|4096
|8192
|16384
|-
|-
|<math>x ^ 2\,</math>
| <code>dict</code>
| A mutable [[associative array]] (or dictionary) of key and value pairs.<br>Can contain mixed types (keys and values). Keys must be a hashable type.
|1
| <code>{'key1': 1.0, 3: False}</code>
|4
|-
|[[9 (number)|9]]
| <code>int</code>
|16
| An immutable [[integer (computer science)|integer]] of unlimited magnitude.<ref name="pep0237" />
|25
| <code>42</code>
|36
|-
|[[49 (number)|49]]
| <code>float</code>
|64
| An immutable [[floating point]] number (system-defined precision).
|[[81 (number)|81]]
| <code>3.1415927</code>
|[[100 (number)|100]]
|-
|[[121 (number)|121]]
| <code>complex</code>
|[[144 (number)|144]]
| An immutable [[complex number]] with real and imaginary parts.
|[[169 (number)|169]]
| <code>3+2.7j</code>
|[[196 (number)|196]]
|-
| <code>bool</code>
| An immutable [[boolean value]].
| <code>True</code><br><code>False</code>
|-
| <code>ellipsis</code>
| An [[Ellipsis (programming operator)|ellipsis]] placeholder to be used as an index in [[NumPy]] arrays.
| <code>...</code>
|}
|}


=== Mathematics ===
{{anchor|glyph}}
Python has the usual C arithmetic operators (+, -, *, /, %). It also has ** for exponentiation, e.g. <code>5**3 == 125</code> and <code>9**.5 == 3.0</code> and a new matrix multiply operator @ coming in 3.5.<ref>{{cite web|url=http://legacy.python.org/dev/peps/pep-0465/|title=PEP 465 -- A dedicated infix operator for matrix multiplication|work=python.org}}</ref>


The behavior of division has changed significantly over time.<ref name="pep0238"/>
==Evolution of the glyph==
* Python 2.1 and earlier use the C division behavior. The / operator is integer division if both operands are integers, and floating point division otherwise. Integer division rounds towards 0, e.g. {{nowrap|1=<code>7 / 3 == 2</code>}} and {{nowrap|1=<code>-7 / 3 == -2</code>.}}
[[Image:Evolution2glyph.png|x50px|right]]
* Python 2.2 changes integer division to round towards negative infinity, e.g. <code>7 / 3 == 2</code> and <code>-7 / 3 == -3</code>. The floor division // operator is introduced. So <code>7 // 3 == 2</code>, <code>-7 // 3 == -3</code>, <code>7.5 // 3 == 2.0</code> and <code>-7.5 // 3 == -3.0</code>. Adding <code>from __future__ import division</code> causes a module to use Python 3.0 rules for division (see next).
The [[glyph]] used in the modern Western world to represent the number 2 traces its roots back to the Brahmin Indians, who wrote "2" as two horizontal lines. The modern [[Chinese written language|Chinese]] and [[Japanese writing system|Japanese]] languages still use this method. The [[Gupta script|Gupta]] rotated the two lines 45 degrees, making them diagonal, and sometimes also made the top line shorter and made its bottom end curve towards the center of the bottom line. Apparently for speed, the [[Devanagari|Nagari]] started making the top line more like a curve and connecting to the bottom line. The Ghubar Arabs made the bottom line completely vertical, and now the glyph looks like a dotless closing question mark. Restoring the bottom line to its original horizontal position, but keeping the top line as a curve that connects to the bottom line leads to our modern glyph.<ref>Georges Ifrah, ''The Universal History of Numbers: From Prehistory to the Invention of the Computer'' transl. David Bellos et al. London: The Harvill Press (1998): 393, Fig. 24.62</ref>
* Python 3.0 changes / to always be floating point division. In Python terms, the pre-3.0 / is "classic division", the 3.0 / is "real division", and // is "floor division".


Rounding towards negative infinity, though different from most languages, adds consistency. For instance, it means that the equation <code>(a+b) // b == a // b + 1</code> is always true. It also means that the equation <code> b * (a // b) + a % b == a</code> is valid for both positive and negative values of <code>a</code>. However, maintaining the validity of this equation means that while the result of <code>a % b</code> is, as expected, in the [[half-open interval]] [0,''b''), where <code>b</code> is a positive integer, it has to lie in the interval (''b'',0] when <code>b</code> is negative.<ref name="AutoNT-62" />
In fonts with [[text figures]], 2 usually is of [[x-height]], for example, [[Image:Text figures 256.svg]].


Python provides a <code>round</code> function for [[rounding]] floats to integers. Versions before 3 use round-away-from-zero: <code>round(0.5)</code> is 1.0, <code>round(-0.5)</code> is −1.0.<ref name="AutoNT-63" /> Python 3 uses [[Round to even|round-to-even]]: <code>round(1.5)</code> is 2, <code>round(2.5)</code> is 2.<ref name="AutoNT-64" /> The <code>Decimal</code> type/class in module <code>decimal</code> (since version 2.4) provides exact numerical representation and several rounding modes.
==In science==
[[Image:Seven-segment 2.svg|25px|right]]
*The number of [[polynucleotide]] strands in a [[DNA]] [[double helix]].
*The first [[Magic number (physics)|magic number]].
*The [[atomic number]] of [[helium]].
*The [[ASCII]] code of "[[Start Of Text|Start of Text]]"
*Group '''2''' in the [[Periodic table]] of the elements consists of the [[alkaline earth]] metals whose usual [[valence (chemistry)|valence]] is +2.
*Period '''2''' in the Periodic table consists of the eight elements [[lithium]] through [[neon]].


Python allows boolean expressions with multiple equality relations in a manner that is consistent with general usage in mathematics. For example, the expression <code>a < b < c</code> tests whether <code>a</code> is less than <code>b</code> and <code>b</code> is less than <code>c</code>. C-derived languages interpret this expression differently: in C, the expression would first evaluate <code>a < b</code>, resulting in 0 or 1, and that result would then be compared with <code>c</code>.<ref name="AutoNT-65" />{{Page needed|date=January 2012}}
===Astronomy===
*[[Messier object]] [[Messier 2|M2]], a magnitude 6.5 [[globular cluster]] in the constellation [[Aquarius (constellation)|Aquarius]].
*The [[New General Catalogue]] [http://www.ngcic.org/ object] [[NGC 2]], a [[visual magnitude|magnitude]] 14.2 [[spiral galaxy]] in the [[constellation]] [[Pegasus (constellation)|Pegasus]]
*The [[Saros number|Saros]] [http://sunearth.gsfc.nasa.gov/eclipse/SEsaros/SEsaros1-175.html number] of the [[solar eclipse]] series which began on May 4, 2861 BC and ended on June 21, 1563 BC . The duration of Saros series 2 was 1298.1 years, and it contained 73 solar eclipses.
*The Saros [http://sunearth.gsfc.nasa.gov/eclipse/LEsaros/LEsaros1-175.html number] of the [[lunar eclipse]] series which began on February 21, 2541 BC and ended on April 22, 1225 BC. The duration of Saros series 2 was 1316.2 years, and it contained 74 lunar eclipses.
*The Roman numeral II stands for [[bright giant]] in the [[stellar classification|Yerkes spectral classification scheme]].
*The Roman numeral II (usually) stands for the second-discovered satellite of a planet or minor planet (e.g. [[Pluto II]] or [[(87) Sylvia II Remus]])
*A [[binary star]] is a [[Star system|stellar system]] consisting of two [[star]]s [[Planetary orbit|orbit]]ing around their [[center of mass]].


Due to Python's extensive mathematics library, it is frequently used as a scientific scripting language to aid in problems such as data processing and manipulation.
==In technology==
[[Image:U+2674 DejaVu Sans.svg|50px|right|2 as a resin identification code, used in recycling.]]
* The [[resin identification code]] used in recycling to identify [[high-density polyethylene]].


==In religion==
== Libraries ==
Python has a large [[standard library]], commonly cited as one of Python's greatest strengths,<ref name="AutoNT-86" /> providing tools suited to many tasks. This is deliberate and has been described as a "batteries included"<ref name="About" /> Python philosophy. For Internet-facing applications, a large number of standard formats and protocols (such as [[MIME]] and [[Hypertext Transfer Protocol|HTTP]]) are supported. Modules for creating [[graphical user interface]]s, connecting to [[relational database]]s, [[pseudorandom number generator]]s, arithmetic with arbitrary precision decimals,<ref name="AutoNT-88" /> manipulating [[regular expression]]s, and doing [[unit testing]] are also included.
===Judaism===
The number 2 is important in [[Judaism]], with one of the earliest reference being that God ordered Noah to put two of every [[unclean animals|unclean animal]] (Gen. 7:2) in his ark (see [[Noah's Ark]]). Later on, the [[Ten Commandments]] were given in the form of two tablets. The number also has ceremonial importance, such as the two candles that are traditionally kindled to usher in the [[Shabbat]], recalling the two different ways Shabbat is referred to in the two times the [[Ten Commandments]] are recorded in the [[Torah]]. These two expressions are known in [[Hebrew language|Hebrew]] as שמור וזכור ("guard" and "remember"), as in "Guard the Shabbat day to sanctify it" (Deut. 5:12) and "Remember the Shabbat day to sanctify it" (Ex. 20:8). Two [[challah]]s (''lechem mishneh'') are placed on the table for each [[Shabbat]] meal and a blessing made over them, to commemorate the double portion of [[manna]] which fell in the [[The Exodus|desert]] every Friday to cover that day's meals and the Shabbat meals


Some parts of the standard library are covered by specifications (for example, the [[Web Server Gateway Interface|WSGI]] implementation <code>wsgiref</code> follows PEP 333<ref name="AutoNT-89" />), but the majority of the modules are not. They are specified by their code, internal documentation, and test suite (if supplied). However, because most of the standard library is cross-platform Python code, there are only a few modules that must be altered or completely rewritten by alternative implementations.
In [[Halakha|Jewish law]], the testimony of two witnesses are required to verify and validate events, such as [[Jewish view of marriage|marriage]], divorce, and a crime that warrants [[capital punishment]].


The standard library is not essential to run Python or embed Python within an application. [[Blender (software)|Blender 2.49]], for instance, omits most of the standard library.
"Second-Day Yom Tov" (''Yom Tov Sheini Shebegaliyot'') is a rabbinical enactment that mandates a two-day celebration for each of the one-day [[Jewish holiday|Jewish festivals]] (i.e., the first and seventh day of [[Passover]], the day of [[Shavuot]], the first day of [[Sukkot]], and the day of [[Shemini Atzeret]]) outside the [[Land of Israel]].


As of January 2015, the [[Python Package Index]], the official repository of third-party software for Python, contains more than 54,000 packages offering a wide range of functionality, including:
==Numerological significance==
* graphical user interfaces, web frameworks, multimedia, databases, networking and communications
[[Image:2 playing cards.jpg|thumb|250px|The twos of all four suits in [[playing card]]s]]
* test frameworks, automation and web scraping, documentation tools, system administration
* scientific computing, text processing, image processing


== Development environments ==
The most common philosophical [[dichotomy]] is perhaps the one of [[Goodness and value theory|good]] and [[evil]], but there are many others. See [[dualism]] for an overview. In [[Georg Wilhelm Friedrich Hegel|Hegel]]ian [[dialectic]], the process of [[Thesis, antithesis, synthesis|synthesis]] creates two perspectives from one.
{{See also|Comparison of integrated development environments#Python}}
Most Python implementations (including CPython) can function as a [[command line interpreter]], for which the user enters statements sequentially and receives the results immediately ([[REPL]]). In short, Python acts as a [[command-line interface|shell]].
The ancient Sanskrit language (संस्कृत भाषा) of India, does not only have a singular and plural form for nouns, as do most other languages, but instead has, a singular (1) form, a dual (2) form, and a plural (everything above 2) form, for all nouns, due to the significance of 2. It is viewed as important because of the anatomical significance of 2 (2 hands, 2 nostrils, 2 eyes, 2 legs, etc.)


Other shells add capabilities beyond those in the basic interpreter, including [[IDLE (Python)|IDLE]] and [[IPython]]. While generally following the visual style of the Python shell, they implement features like auto-completion, retention of session state, and syntax highlighting.
Two (二, ''èr'') is a good [[number in Chinese culture]]. There is a Chinese saying, "good things come in pairs". It is common to use double symbols in product brandnames, e.g. double happiness, double coin, double elephants etc. [[Guangdong|Cantonese]] people like the number two because it sounds the same as the word "easy" (易) in [[Cantonese language|Cantonese]].


In addition to standard desktop [[Python IDE]]s (integrated development environments), there are also [[web browser|browser]]-based IDEs, [[Sage (mathematics software)|Sage]] (intended for developing science and math-related Python programs), and a browser-based IDE and hosting environment, [[PythonAnywhere]].
In [[Finland]], two [[candle]]s are lit on [[Independence Day (Finland)|Independence Day]]. Putting them on the windowsill invokes the symbolical meaning of division, and thus independence. {{Citation needed|date=May 2008}}


== Implementations ==
In pre-1972 [[Indonesian language|Indonesian]] and [[Malay language|Malay]] orthography, ''2'' was shorthand for the [[reduplication]] that forms plurals: ''orang'' "person", ''orang-orang'' or ''orang2'' "people". {{Citation needed|date=May 2008}}
{{See also|List of Python software#Python implementations}}


The main Python implementation, named ''[[CPython]]'', is written in [[C (programming language)|C]] meeting the [[C89 (C version)|C89]] standard.<ref name="AutoNT-66" /> It compiles Python programs into intermediate [[bytecode]],<ref name="AutoNT-67" /> which is executed by the [[virtual machine]].<ref name="AutoNT-68" /> CPython is distributed with a large standard library written in a mixture of C and Python. It is available in versions for many platforms, including [[Microsoft Windows]] and most modern [[Unix-like]] systems. CPython was intended from almost its very conception to be cross-platform.<ref name="AutoNT-69" />
In [[Astrology]], [[Taurus (constellation)|Taurus]] is the second [[astrological sign|sign]] of the [[Zodiac]].


[[PyPy]] is a fast, compliant<ref name="AutoNT-70" /> interpreter of Python 2.7 and 3.2. Its [[Just-in-time compilation|just-in-time compiler]] brings a significant speed improvement over CPython.<ref name="AutoNT-71" /> A version taking advantage of [[multi-core processor]]s using [[software transactional memory]] is being created.<ref name="AutoNT-72" />
==In sports==
[[Baseball]]:
*In baseball scorekeeping, 2 is the position of the catcher.


[[Stackless Python]] is a significant fork of CPython that implements [[microthread]]s; it does not use the C memory stack, thus allowing massively concurrent programs. PyPy also has a stackless version.<ref name="AutoNT-73" />
[[Football]]:
*In [[American football]], a safety has a two-point value. Also, a two-point conversion is a point after touchdown (PAT) attempt where the ball crosses the goal line via run or pass. (In [[six-man football]], however, the traditional PAT kick is worth two points, whereas a PAT via pass or run is only one point.)
*In [[Association football]], the scoring of two goals by one individual in a single match is referred to as a brace.
**The successor of a ''brace'' is the "'''[[hat-trick]]'''", three goals scored by one player.


Other just-in-time compilers have been developed in the past, but are now unsupported:
[[Basketball]]:
* Google started a project called [[Unladen Swallow]] in 2009 with the aims of increasing the speed of the Python interpreter by 5 times by using the [[LLVM]] and improving its multithreading ability to scale to thousands of cores.<ref name="AutoNT-74" />
* In standard basketball, the value of any made shot taken from inside the [[Three-point field goal|three-point arc]] in normal play is 2 points.
* [[Psyco]] is a [[specialising compiler|specialising]] [[just in time compiler]] that integrates with CPython and transforms bytecode to machine code at runtime. The produced code is specialised for certain [[data types]] and is faster than standard Python code.
* In the half-court [[3x3 (basketball)|3x3]] variant, made shots taken from outside the "three-point" arc are worth 2 points.


In 2005, [[Nokia]] released a Python interpreter for the [[Series 60]] mobile phones called [[PyS60]]. It includes many of the modules from the CPython implementations and some additional modules for integration with the [[Symbian]] operating system. This project has been kept up to date to run on all variants of the S60 platform and there are several third party modules available. The Nokia [[N900]] also supports Python with [[GTK]] widget libraries, with the feature that programs can be both written and run on the device itself.<ref>{{cite web|title=Python on the Nokia N900|url=http://www.stochasticgeometry.ie/2010/04/29/python-on-the-nokia-n900/|website=Stochastic Geometry}}</ref>
==In other fields==
{{Double image|right|ICS Pennant Two.svg|100|ICS Two.svg|100|[[Pennant (commissioning)|International maritime pennant]] for 2|[[International maritime signal flag]] for 2}}
Groups of two:
*[[Lists of pairs]]
**[[list of twins]]


There are several compilers to high-level [[object language]]s, with either unrestricted Python, a restricted subset of Python, or a language similar to Python as the source language:
*The name of several fictional characters: '''''[[Number Two (disambiguation)|Number Two]]'''''.
* [[Jython]] compiles into Java byte code, which can then be executed by every [[Java Virtual Machine]] implementation. This also enables the use of Java class library functions from the Python program.
*The designation of the [[Trans-Canada Highway]] in most of the province of [[New Brunswick]].
* [[IronPython]] follows a similar approach in order to run Python programs on the .NET [[Common Language Runtime]].
*[[U.S. Route 2]], two separated highways in the northern tier of the United States, the western segment connecting [[Everett, Washington]] to [[St. Ignace, Michigan]] and the eastern route connecting [[Rouses Point, New York]] to [[Houlton, Maine]].
* The [[RPython]] language can be compiled to [[C (programming language)|C]], [[Java bytecode]], or [[Common Intermediate Language]], and is used to build the PyPy interpreter of Python.
*The lowest channel of television in the United States, Canada, Argentina and Mexico on which television signals are broadcast.
* [[Pyjamas (software)|Pyjamas]] compiles Python to [[JavaScript]].
*Brace is also used in [[hunting]] to refer to a pair. For example, "He shot a brace of pheasants".
* [[Shed Skin]] compiles Python to [[C++]].
* "Two turtle doves" is the gift on the second day of Christmas in the carol "[[The Twelve Days of Christmas (song)|The Twelve Days of Christmas]]"
* [[Cython]] and [[Pyrex (programming language)|Pyrex]] compile to [[C (programming language)|C]].


A performance comparison of various Python implementations on a non-numerical (combinatorial) workload was presented at EuroSciPy '13.<ref>{{cite conference |title=Performance of Python runtimes on a non-numeric scientific code |last=Murri |first=Riccardo |conference=European Conference on Python in Science (EuroSciPy) |year=2013 |url=http://arxiv.org/abs/1404.6388}}</ref>
In North American educational systems, the number 2.00 denotes a [[academic grading in North America|grade-point average]] of "C", which in some colleges and universities is the minimum required for good academic standing at the [[undergraduate]] level.<ref>''For a typical example'', ''see'' the [http://admissions.ou.edu/graderegs.htm#retention University of Oklahoma grading regulations].</ref>

== Development ==
Python's development is conducted largely through the Python Enhancement Proposal (PEP) process. The PEP process is the primary mechanism for proposing major new features, for collecting community input on an issue, and for documenting the design decisions that have gone into Python.<ref name="PepCite000" /> Outstanding PEPs are reviewed and commented upon by the Python community and by Van Rossum, the Python project's [[BDFL]].<ref name="PepCite000" />

Enhancement of the language goes along with development of the CPython reference implementation. The mailing list python-dev is the primary forum for discussion about the language's development; specific issues are discussed in the [[Roundup (issue tracker)|Roundup]] [[bug tracker]] maintained at python.org.<ref name="AutoNT-21" /> Development takes place on a [[self-hosted]] source code repository running [[Mercurial]].<ref name=py_dev_guide>{{cite web|title=Python Developer's Guide|url=https://docs.python.org/devguide/}}</ref>

CPython's public releases come in three types, distinguished by which part of the version number is incremented:
* Backwards-incompatible versions, where code is expected to break and must be manually [[ported]]. The first part of the version number is incremented. These releases happen infrequently—for example, version 3.0 was released 8 years after 2.0.
* Major or "feature" releases, which are largely compatible but introduce new features. The second part of the version number is incremented. These releases are scheduled to occur roughly every 18 months, and each major version is supported by bugfixes for several years after its release.<ref name="release-schedule" />
* Bugfix releases, which introduce no new features but fix bugs. The third and final part of the version number is incremented. These releases are made whenever a sufficient number of bugs have been fixed upstream since the last release, or roughly every 3 months. Security vulnerabilities are also patched in bugfix releases.<ref name="AutoNT-22" />

A number of [[beta release|alpha, beta, and release-candidates]] are also released as previews and for testing before the final release is made. Although there is a rough schedule for each release, this is often pushed back if the code is not ready. The development team monitor the state of the code by running the large [[unit test]] suite during development, and using the [[BuildBot]] [[continuous integration]] system.<ref name="AutoNT-23" />

The community of Python developers has also contributed over 58,000 software modules (as of May 2, 2015) to the [[Python Package Index]] (called PyPI), the official repository of third-party libraries for Python.

The major [[academic conference]] on Python is named [[PyCon]]. There are special mentoring programmes like the [[Pyladies]].

== Naming ==
Python's name is derived from the television series ''[[Monty Python's Flying Circus]]'',<ref name="AutoNT-24" /> and it is common to use Monty Python references in example code.<ref name="tutorial-chapter1" /> For example, the [[metasyntactic variable]]s often used in Python literature are [[Spam (Monty Python)|''spam'' and ''eggs'']], instead of the traditional [[foobar|''foo'' and ''bar'']].<ref name="tutorial-chapter1" /><ref name="AutoNT-26" /> As well as this, the official Python documentation often contains various obscure Monty Python references.

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 [[language binding|binding]] of [[Simple DirectMedia Layer|SDL]] to Python (commonly used to create games); [[PyS60]], an implementation for the [[Symbian]] [[S60 (software platform)|S60]] operating system; [[PyQt]] and [[PyGTK]], which bind [[Qt (framework)|Qt]] and [[GTK]], respectively, to Python; and [[PyPy]], a Python implementation originally written in Python.

== Use ==
{{Main|List of Python software}}

Since 2008, Python has consistently ranked in the top eight most popular programming languages as measured by the [[TIOBE Programming Community Index]].<ref name="AutoNT-34" /> It is the third most popular language whose [[Syntax (programming languages)|grammatical syntax]] is not predominantly based on [[C (programming language)|C]], e.g. C++, C#, Objective-C, Java.

An empirical study found scripting languages (such as Python) more productive than conventional languages (such as C and Java) for a programming problem involving string manipulation and search in a dictionary. Memory consumption was often "better than Java and not much worse than C or C++".<ref name="AutoNT-28" />

Large organizations that make use of Python include [[Google]],<ref name="quotes-about-python" /> [[Yahoo!]],<ref name="AutoNT-29" /> [[CERN]],<ref name="AutoNT-30" /> [[NASA]],<ref name="AutoNT-31" /> and some smaller ones like [[Industrial Light & Magic|ILM]],<ref name="AutoNT-32" /> and [[ITA Software|ITA]].<ref name="AutoNT-33" />

Python can serve as a [[scripting language]] for [[web application]]s, e.g., via [[mod_wsgi]] for the [[Apache web server]].<ref name="AutoNT-35" /> With [[Web Server Gateway Interface]], a standard API has evolved to facilitate these applications. [[Web application framework]]s like [[Django (web framework)|Django]], [[Pylons project|Pylons]], [[Pyramid (web framework)|Pyramid]], [[TurboGears]], [[web2py]], [[Tornado (web server)|Tornado]], [[Flask (programming)|Flask]] and [[Zope]] support developers in the design and maintenance of complex applications. [[Pyjamas (software)|Pyjamas]] and [[IronPython]] can be used to develop the client-side of Ajax-based applications. [[SQLAlchemy]] can be used as [[Data mapper pattern|data mapper]] to a relational database. [[Twisted (software)|Twisted]] is a framework to program communications between computers, and is used (for example) by [[Dropbox (service)|Dropbox]].

Libraries like [[NumPy]], [[SciPy]] and [[Matplotlib]] allow the effective use of Python in scientific computing,<ref name="cise">{{cite journal |last=Oliphant |first=Travis |title=Python for Scientific Computing |journal=Computing in Science and Engineering |year=2007 |url=https://www.h2desk.com/blog/python-scientific-computing/}}</ref><ref name="millman">{{cite journal |first1=K. Jarrod |last1=Millman |first2=Michael |last2=Aivazis |title=Python for Scientists and Engineers |journal=Computing in Science and Engineering |volume=13 |number=2 |pages=9–12 |year=2011 |url=http://www.computer.org/csdl/mags/cs/2011/02/mcs2011020009.html}}</ref> with specialized libraries such as [[BioPython]] and [[Astropy]] providing domain-specific functionality. [[Sage (mathematics software)|Sage]] is a [[mathematical software]] with a "notebook" programmable in Python: its library covers many aspects of [[mathematics]], including [[algebra]], [[combinatorics]], [[numerical mathematics]], [[number theory]], and [[calculus]].

Python has been successfully embedded in a number of software products as a scripting language, including in [[finite element method]] software such as [[Abaqus]], 3D parametric modeler like [[FreeCAD]], 3D animation packages such as [[3ds Max]], [[Blender (software)|Blender]], [[Cinema 4D]], [[Lightwave]], [[Houdini (software)|Houdini]], [[Maya (software)|Maya]], [[modo (software)|modo]], [[MotionBuilder]], [[Softimage XSI|Softimage]], the visual effects compositor [[Nuke (software)|Nuke]], 2D imaging programs like [[GIMP]],<ref>{{cite web |url= http://gimp-win.sourceforge.net/faq.html|title=Installers for GIMP for Windows - Frequently Asked Questions |author=<!-- Staff writer(s); no by-line. --> |date=26 July 2013 |accessdate=26 July 2013}}</ref> [[Inkscape]], [[Scribus]] and [[Paint Shop Pro]],<ref name="AutoNT-38" /> and [[musical notation]] program or [[scorewriter]] [[Capella (notation program)|capella]]. [[GNU Debugger]] uses Python as a [[Prettyprint|pretty printer]] to show complex structures such as C++ containers. [[Esri]] promotes Python as the best choice for writing scripts in [[ArcGIS]].<ref name="AutoNT-39" /> It has also been used in several video games,<ref name="AutoNT-40" /><ref name="AutoNT-41" /> and has been adopted as first of the three available [[programming language]]s in [[Google App Engine]], the other two being [[Java (software platform)|Java]] and [[Go (programming language)|Go]].<ref name="AutoNT-42" />

Python has also been used in [[artificial intelligence]] tasks.<ref name="AutoNT-43" /><ref name="AutoNT-44" /><ref name="AutoNT-45" /><ref name="AutoNT-46" /> As a scripting language with module architecture, simple syntax and rich text processing tools, Python is often used for [[natural language processing]] tasks.<ref name="AutoNT-47" />

Many operating systems include Python as a standard component; the language ships with most [[Linux distribution]]s, [[AmigaOS 4]], [[FreeBSD]], [[NetBSD]], [[OpenBSD]] and [[OS X]], and can be used from the terminal. A number of Linux distributions use installers written in Python: [[Ubuntu (operating system)|Ubuntu]] uses the [[Ubiquity (software)|Ubiquity]] installer, while [[Red Hat Linux]] and [[Fedora (operating system)|Fedora]] use the [[Anaconda (installer)|Anaconda]] installer. [[Gentoo Linux]] uses Python in its [[package management system]], [[Portage (software)|Portage]].

Python has also seen extensive use in the [[information security]] industry, including in exploit development.<ref name="AutoNT-49" /><ref name="AutoNT-50" />

Most of the [[Sugar (GUI)|Sugar]] software for the [[One Laptop per Child]] XO, now developed at [[Sugar Labs]], is written in Python.<ref name="AutoNT-51" />

The [[Raspberry Pi]] [[single-board computer]] project has adopted Python as its principal user-programming language.

[[LibreOffice]] includes Python and intends to replace Java with Python. Python Scripting Provider is a core feature<ref>{{cite web |title=4.0 New Features and Fixes |publisher=[[The Document Foundation]] |work=LibreOffice.org |year=2013 |url=http://www.libreoffice.org/download/4-0-new-features-and-fixes/ |accessdate=25 February 2013}}</ref> since Version 4.0 from 7 February 2013.

== Languages influenced by Python ==
Python's design and philosophy have influenced several programming languages, including:
* [[Boo (programming language)|Boo]] uses indentation, a similar syntax, and a similar object model. However, Boo uses [[static typing]] (as well as optional [[duck typing]]) and is closely integrated with the [[.NET Framework]].<ref name="AutoNT-90" />
* [[Cobra (programming language)|Cobra]] uses indentation and a similar syntax. Cobra's "Acknowledgements" document lists Python first among languages that influenced it.<ref name="AutoNT-91" /> However, Cobra directly supports [[Design by contract|design-by-contract]], [[Unit testing|unit tests]], and optional [[static typing]].<ref name="AutoNT-92" />
* [[ECMAScript]] borrowed [[iterator]]s, [[generator (computer science)|generators]], and [[list comprehension]]s from Python.<ref name="AutoNT-93" />
* [[Go (programming language)|Go]] is described as incorporating the "development speed of working in a dynamic language like Python".<ref name="AutoNT-94" />
* [[Groovy (programming language)|Groovy]] was motivated by the desire to bring the Python design philosophy to [[Java (programming language)|Java]].<ref name="AutoNT-95" />
* [[OCaml]] has an optional syntax, called twt (The Whitespace Thing), inspired by Python and [[Haskell (programming language)|Haskell]].<ref name="AutoNT-96" />
* [[Ruby (programming language)|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."<ref name="linuxdevcenter" />
* [[CoffeeScript]] is a programming language that cross-compiles to JavaScript; it has Python inspired syntax.
* [[Swift (programming language)|Swift]] is a programming language invented by Apple; it has some Python inspired syntax.<ref>{{cite web |url=http://nondot.org/sabre |title=Chris Lattner's Homepage |publisher=Chris Lattner |first=Chris |last=Lattner |authorlink=Chris Lattner |date=3 June 2014 |accessdate=3 June 2014 |quote=I started work on the Swift Programming Language in July of 2010. I implemented much of the basic language structure, with only a few people knowing of its existence. A few other (amazing) people started contributing in earnest late in 2011, and it became a major focus for the Apple Developer Tools group in July 2013 [...] drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list.}}</ref>

Python's development practices have also been emulated by other languages. The practice of requiring a document describing the rationale for, and issues surrounding, a change to the language (in Python's case, a PEP) is also used in [[Tcl]]<ref name="AutoNT-99" /> and [[Erlang (programming language)|Erlang]]<ref name="AutoNT-100" /> because of Python's influence.

Python has been awarded a TIOBE Programming Language of the Year award twice (in 2007 and 2010), which is given to the language with the greatest growth in popularity over the course of a year, as measured by the [[TIOBE index]].<ref name="AutoNT-101" />


== See also ==
== See also ==
{{Portal|Mathematics}}
{{Portal|Free software|Python programming}}
* [[Comparison of integrated development environments#Python|Comparison of integrated development environments for Python]]
* [[Square (algebra)]] &mdash; (2 [[superscript]])
* [[Python for S60]]
* [[Off-side rule#Off-side rule languages|Off-side rule languages]], where blocks are expressed by indentation
* [[Comparison of programming languages]]
* [[List of programming languages]]
* [[LAMP (software bundle)]]
* [[LEAP (software bundle)]]

== References ==
{{Reflist|30em|refs=
<ref name="faq-created">{{cite web |url=https://docs.python.org/faq/general.html#why-was-python-created-in-the-first-place |title=Why was Python created in the first place? |work=General Python FAQ |publisher=Python Software Foundation |accessdate=22 March 2007}}</ref>
<ref name="98-interview">{{cite web |url=http://www.amk.ca/python/writing/gvr-interview |title=Interview with Guido van Rossum (July 1998) |last=Kuchling |first=Andrew M. |work=amk.ca |date=22 December 2006 |accessdate=12 March 2012}}</ref>
<ref name="AutoNT-1">{{ cite journal |last=van Rossum |first=Guido |year=1993 |title=An Introduction to Python for UNIX/C Programmers |journal=Proceedings of the NLUUG najaarsconferentie (Dutch UNIX users group) |quote=even though the design of C is far from ideal, its influence on Python is considerable. |url=http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.38.2023}}</ref>
<ref name="classmix">{{cite web |url=https://docs.python.org/tutorial/classes.html |title=Classes |work=The Python Tutorial |publisher=Python Software Foundation |accessdate=20 February 2012 |quote=It is a mixture of the class mechanisms found in C++ and Modula-3}}</ref>
<ref name="AutoNT-2">{{cite web |url=https://www.python.org/download/releases/2.3/mro/ |title=The Python 2.3 Method Resolution Order |last=Simionato |first=Michele |publisher=Python Software Foundation |quote=The C3 method itself has nothing to do with Python, since it was invented by people working on Dylan and it is described in a paper intended for lispers}}</ref>
<ref name="AutoNT-3">{{cite web |url=https://docs.python.org/howto/functional.html |title=Functional Programming HOWTO |last=Kuchling |first=A. M. |work=Python v2.7.2 documentation |publisher=Python Software Foundation |accessdate=9 February 2012}}</ref>
<ref name="pep0238">{{cite web |url=https://www.python.org/dev/peps/pep-0238/ |title=PEP 238&nbsp;– Changing the Division Operator |first1=Moshe |last1=Zadka |first2=Guido |last2=van Rossum |date=11 March 2001 |work=Python Enhancement Proposals |publisher=Python Software Foundation |accessdate=23 October 2013}}</ref>
<ref name="AutoNT-4">{{cite web |url=https://www.python.org/dev/peps/pep-0255/ |title=PEP 255&nbsp;– Simple Generators |first1=Neil |last1=Schemenauer |first2=Tim |last2=Peters |first3=Magnus Lie |last3=Hetland |date=18 May 2001 |work=Python Enhancement Proposals |publisher=Python Software Foundation |accessdate=9 February 2012}}</ref>
<ref name="AutoNT-5">{{cite web |url=https://www.python.org/dev/peps/pep-0318/ |title=PEP 318&nbsp;– Decorators for Functions and Methods |first1=Kevin D. |last1=Smith |first2=Jim J. |last2=Jewett |first3=Skip |last3=Montanaro |first4=Anthony |last4=Baxter |date=2 September 2004 |work=Python Enhancement Proposals |publisher=Python Software Foundation |accessdate=24 February 2012}}</ref>
<ref name="AutoNT-6">{{cite web |url=https://docs.python.org/py3k/tutorial/controlflow.html |title=More Control Flow Tools |work=Python 3 documentation |publisher=Python Software Foundation |accessdate=5 August 2012}}</ref>
<ref name="bini">{{ cite book |last=Bini |first=Ola |title=Practical JRuby on Rails Web 2.0 Projects: bringing Ruby on Rails to the Java platform |year=2007 |publisher=APress |location=Berkeley |isbn=978-1-59059-881-8 |page=3}}</ref>
<ref name="AutoNT-7">{{cite web |last=Kuhlman |first=Dave |url=http://cutter.rexx.com/~dkuhlman/python_book_01.html |title=A Python Book: Beginning Python, Advanced Python, and Python Exercises}}</ref>
<ref name="About">{{cite web |url=https://www.python.org/about |title=About Python |publisher=Python Software Foundation |accessdate=24 April 2012}}, second section "Fans of Python use the phrase "batteries included" to describe the standard library, which covers everything from asynchronous processing to zip files."</ref>
<ref name="venners-interview-pt-1">{{cite web |url=http://www.artima.com/intv/pythonP.html |title=The Making of Python |last=Venners |first=Bill |date=13 January 2003 |work=Artima Developer |publisher=Artima |accessdate=22 March 2007}}</ref>
<ref name="timeline-of-python">{{cite web |url=http://python-history.blogspot.com/2009/01/brief-timeline-of-python.html |title=A Brief Timeline of Python |last=van Rossum |first=Guido |date=20 January 2009 |work=The History of Python |publisher=Google |accessdate=20 January 2009}}</ref>
<ref name="AutoNT-12">{{ cite mailing list |url=http://mail.python.org/pipermail/python-dev/2000-August/008881.html |title=SETL (was: Lukewarm about range literals) |date=29 August 2000 |accessdate=13 March 2011 |mailinglist=Python-Dev |last=van Rossum |first=Guido |authorlink=Guido van Rossum}}</ref>
<ref name="newin-2.0">{{cite web |url=https://docs.python.org/whatsnew/2.0.html |title=What's New in Python 2.0 |last1=Kuchling |first1=A. M. |last2=Zadka |first2=Moshe |date=16 October 2000 |publisher=Python Software Foundation |accessdate=11 February 2012}}</ref>
<ref name="3.0-release">{{cite web |url=https://www.python.org/download/releases/3.0/ |title=Python 3.0 Release |publisher=Python Software Foundation |accessdate=8 July 2009}}</ref>
<ref name="pep-3000">{{cite web |url=https://www.python.org/dev/peps/pep-3000/ |title=PEP 3000&nbsp;– Python 3000 |last=van Rossum |first=Guido |date=5 April 2006 |work=Python Enhancement Proposals |publisher=Python Software Foundation |accessdate=27 June 2009}}</ref>
<ref name="AutoNT-13">{{cite web |url=https://www.python.org/community/pycon/dc2004/papers/24/metaclasses-pycon.pdf |archiveurl=http://www.webcitation.org/5lubkaJRc |archivedate=10 December 2009 |format=PDF |title=Python Metaclasses: Who? Why? When? |last=The Cain Gang Ltd. |accessdate=27 June 2009}}</ref>
<ref name="AutoNT-14">{{cite web |url=https://docs.python.org/3.0/reference/datamodel.html#special-method-names |title=3.3. Special method names |work=The Python Language Reference |publisher=Python Software Foundation |accessdate=27 June 2009}}</ref>
<ref name="AutoNT-15">{{cite web |url=http://www.nongnu.org/pydbc/ |title=PyDBC: method preconditions, method postconditions and class invariants for Python |accessdate=24 September 2011}}</ref>
<ref name="AutoNT-16">{{cite web |url=http://www.wayforward.net/pycontract/ |title=Contracts for Python |accessdate=24 September 2011}}</ref>
<ref name="AutoNT-17">{{cite web |url=https://sites.google.com/site/pydatalog/ |title=PyDatalog |accessdate=22 July 2012}}</ref>
<ref name="AutoNT-18">{{cite web |url=https://docs.python.org/lib/module-itertools.html |title=6.5 itertools&nbsp;– Functions creating iterators for efficient looping |publisher=Docs.python.org |accessdate=24 November 2008}}</ref>
<ref name="PEP20">{{cite web |url=https://www.python.org/dev/peps/pep-0020/ |title=PEP 20&nbsp;– The Zen of Python |last=Peters |first=Tim |date=19 August 2004 |work=Python Enhancement Proposals |publisher=Python Software Foundation |accessdate=24 November 2008}}</ref>
<ref name="AutoNT-19">Alex Martelli, ''Python Cookbook'' (2nd ed., p. 230)</ref>
<ref name="AutoNT-20">{{cite web|url=http://ebeab.com/2014/01/21/python-culture/|title=Python Culture}}</ref>
<ref name="PepCite000">{{cite web |url=https://www.python.org/dev/peps/pep-0001/ |title=PEP 1&nbsp;– PEP Purpose and Guidelines |last1=Warsaw |first1=Barry |last2=Hylton |first2=Jeremy |last3=Goodger |first3=David |date=13 June 2000 |work=Python Enhancement Proposals |publisher=Python Software Foundation |accessdate=19 April 2011}}</ref>
<ref name="AutoNT-21">{{cite web |url=http://classic-web.archive.org/web/20080229153753/https://www.python.org/dev/intro/ |title=Guido, Some Guys, and a Mailing List: How Python is Developed |last=Cannon |first=Brett |work=python.org |publisher=Python Software Foundation |accessdate=27 June 2009}}</ref>
<ref name="release-schedule">{{cite web |url=https://mail.python.org/pipermail/python-dev/2002-April/022739.html |title=<nowiki>[</nowiki>Python-Dev<nowiki>]</nowiki> Release Schedules (was Stability & change) |last=Norwitz |first=Neal |date=8 April 2002 |accessdate=27 June 2009}}</ref>
<ref name="AutoNT-22">{{cite web |url=https://www.python.org/dev/peps/pep-0006/ |title=PEP 6&nbsp;– Bug Fix Releases |last1=Aahz |last2=Baxter |first2=Anthony |date=15 March 2001 |work=Python Enhancement Proposals |publisher=Python Software Foundation |accessdate=27 June 2009}}</ref>
<ref name="AutoNT-23">{{cite web |url=https://www.python.org/dev/buildbot/ |title=Python Buildbot |work=Python Developer’s Guide |publisher=Python Software Foundation |accessdate=24 September 2011}}</ref>
<ref name="AutoNT-24">{{cite web |url=https://docs.python.org/2/faq/general.html#why-is-it-called-python |title=General Python FAQ |work=Python v2.7.3 documentation |publisher=Docs.python.org |date=|accessdate=3 December 2012}}</ref>
<ref name="tutorial-chapter1">{{cite web |url=https://docs.python.org/tutorial/appetite.html |title=Whetting Your Appetite |work=The Python Tutorial |publisher=Python Software Foundation |accessdate=20 February 2012}}</ref>
<ref name="AutoNT-25">{{cite web |url=http://python.net/crew/mwh/hacks/objectthink.html |title=How to think like a Pythonista}}</ref>
<ref name="AutoNT-26">{{cite web |url=http://stackoverflow.com/questions/5033906/in-python-should-i-use-else-after-a-return-in-an-if-block |title=In Python, should I use else after a return in an if block? |date=17 February 2011 |work=[[Stack Overflow]] |publisher=Stack Exchange |accessdate=6 May 2011}}</ref>
<ref name="AutoNT-27">{{cite web |url=http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html |title=Code Like a Pythonista: Idiomatic Python |last=Goodger |first=David}}</ref>
<ref name="AutoNT-28">{{cite web |url=http://page.mi.fu-berlin.de/prechelt/Biblio/jccpprt_computer2000.pdf |title=An empirical comparison of C, C++, Java, Perl, Python, Rexx, and Tcl |first=Lutz |last=Prechelt |work=[http://page.mi.fu-berlin.de/prechelt/Biblio/ Bibliography of Lutz Prechelt] |date=14 March 2000 |accessdate=30 August 2013}}</ref>
<ref name="quotes-about-python">{{cite web |url=https://www.python.org/about/quotes/ |title=Quotes about Python |publisher=Python Software Foundation |accessdate=8 January 2012}}</ref>
<ref name="AutoNT-29">{{cite web |url=https://wiki.python.org/moin/OrganizationsUsingPython |title=Organizations Using Python |publisher=Python Software Foundation |accessdate=15 January 2009}}</ref>
<ref name="AutoNT-30">{{ cite journal |title=Python : the holy grail of programming |journal=CERN Bulletin |issue=31/2006 |publisher=CERN Publications |date=31 July 2006 |url=http://cdsweb.cern.ch/journal/CERNBulletin/2006/31/News%20Articles/974627?ln=en |accessdate=11 February 2012}}</ref>
<ref name="AutoNT-31">{{cite web |url=https://www.python.org/about/success/usa/ |title=Python Streamlines Space Shuttle Mission Design |last=Shafer |first=Daniel G. |date=17 January 2003 |publisher=Python Software Foundation |accessdate=24 November 2008}}</ref>
<ref name="AutoNT-32">{{cite web |url=https://www.python.org/about/success/ilm/ |title=Industrial Light & Magic Runs on Python |last=Fortenberry |first=Tim |date=17 January 2003 |publisher=Python Software Foundation |accessdate=11 February 2012}}</ref>
<ref name="AutoNT-33">{{cite web |url=http://www.eweek.com/c/a/Application-Development/Python-Slithers-into-Systems/ |title=Python Slithers into Systems |last=Taft |first=Darryl K. |date=5 March 2007 |work=eWeek.com |publisher=Ziff Davis Holdings |accessdate=24 September 2011}}</ref>
<ref name="AutoNT-34">{{cite web |title=TIOBE Programming Community Index Python |author=TIOBE Software Index |year=2012 |url=http://www.tiobe.com/index.php/paperinfo/tpci/Python.html |accessdate=15 October 2012}}</ref>
<ref name="AutoNT-35">{{cite web |title=Usage statistics and market share of Python for websites |year=2012 |url=http://w3techs.com/technologies/details/pl-python/all/all |accessdate=18 December 2012}}</ref>
<ref name="AutoNT-38">{{cite web|url=http://www.jasc.com/support/customercare/articles/psp9components.asp|title=jasc psp9components}}{{Dead link|date=July 2013}}</ref>
<ref name="AutoNT-39">{{cite web |url=http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=About_getting_started_with_writing_geoprocessing_scripts |title=About getting started with writing geoprocessing scripts |date=17 November 2006 |work=ArcGIS Desktop Help 9.2 |publisher=Environmental Systems Research Institute |accessdate=11 February 2012}}</ref>
<ref name="AutoNT-40">{{cite web |url=http://community.eveonline.com/news/dev-blogs/stackless-python-2.7/ |title=Stackless Python 2.7 |publisher=[[CCP Games]] |date=24 August 2010 |author=CCP porkbelly |work=EVE Community Dev Blogs |quote=As you may know, EVE has at its core the programming language known as Stackless Python.}}</ref>
<ref name="AutoNT-41">{{cite web |url=http://www.2kgames.com/civ4/blog_03.htm |title=Modding Sid Meier's Civilization IV |last=Caudill |first=Barry |date=20 September 2005 |publisher=[[Firaxis Games]] |archiveurl=http://www.webcitation.org/5ru5VItfv |archivedate=10 August 2010 |work=Sid Meier's Civilization IV Developer Blog |quote=we created three levels of tools ... The next level offers Python and XML support, letting modders with more experience manipulate the game world and everything in it.}}</ref>
<ref name="AutoNT-42">{{cite web |url=https://code.google.com/apis/documents/docs/1.0/developers_guide_python.html |title=Python Language Guide (v1.0) |work=Google Documents List Data API v1.0 |publisher=Google |archiveurl=http://www.webcitation.org/5ru5FHxfV |archivedate=10 August 2010}}</ref>
<ref name="AutoNT-43">{{cite web |url=https://wiki.python.org/moin/PythonForArtificialIntelligence |title=Python for Artificial Intelligence |publisher=Wiki.python.org |date=19 July 2012 |accessdate=3 December 2012}}{{Dead link |date=January 2013}}</ref>
<ref name="AutoNT-44">{{cite journal |editor-last=Paine |editor-first=Jocelyn |title=AI in Python |journal=AI Expert Newsletter |publisher=Amzi! |date=August 2005 |url=http://www.ainewsletter.com/newsletters/aix_0508.htm#python_ai_ai |accessdate=11 February 2012}}</ref>
<ref name="AutoNT-45">{{cite web|url=https://pypi.python.org/pypi/PyAIML|title=PyAIML 0.8.5 : Python Package Index|publisher=Pypi.python.org|accessdate=17 July 2013}}</ref>
<ref name="AutoNT-46">{{ cite book |title=Artificial Intelligence: A Modern Approach |url=http://aima.cs.berkeley.edu/ |last1=Russell |first1=Stuart J. |authorlink1=Stuart J. Russell |last2=Norvig |first2=Peter |authorlink2=Peter Norvig |lastauthoramp=y |edition=3rd |year=2009 |publisher=Prentice Hall |location=Upper Saddle River, NJ |isbn=978-0-13-604259-4 |page=1062 |accessdate=11 February 2012}}</ref>
<ref name="AutoNT-47">{{cite web |url=http://www.nltk.org|title=Natural Language Toolkit}}</ref>
<ref name="AutoNT-49">{{cite web|url=http://www.immunitysec.com/products-immdbg.shtml|title=Immunity: Knowing You're Secure}}</ref>
<ref name="AutoNT-50">{{cite web|url=http://oss.coresecurity.com/|title=Corelabs site}}</ref>
<ref name="AutoNT-51">{{cite web |url=http://sugarlabs.org/go/Sugar |title=What is Sugar? |publisher=Sugar Labs |accessdate=11 February 2012}}</ref>
<ref name="AutoNT-52">{{cite web |title=Is Python a good language for beginning programmers? |url=https://docs.python.org/faq/general.html#is-python-a-good-language-for-beginning-programmers |work=General Python FAQ |publisher=Python Software Foundation |accessdate=21 March 2007}}</ref>
<ref name="AutoNT-53">{{cite web |url=http://www.secnetix.de/~olli/Python/block_indentation.hawk |title=Myths about indentation in Python |publisher=Secnetix.de |accessdate=19 April 2011}}</ref>
<!--ref name="AutoNT-54">{{cite web |url=http://c2.com/cgi/wiki?PythonWhiteSpaceDiscussion |title=White Space Discussion |accessdate=1 January 2013}}</ref-->
<ref name="AutoNT-55">{{cite web |last=van Rossum |first=Guido |url=http://neopythonic.blogspot.be/2009/04/tail-recursion-elimination.html |title=Tail Recursion Elimination |publisher=Neopythonic.blogspot.be |date=22 April 2009 |accessdate=3 December 2012}}</ref>
<ref name="AutoNT-56">{{cite web |title=Language Design Is Not Just Solving Puzzles |url=http://www.artima.com/weblogs/viewpost.jsp?thread=147358 |first=Guido |last=van Rossum |date=9 February 2006 |accessdate=21 March 2007 |work=Artima forums |publisher=Artima}}</ref>
<ref name="AutoNT-57">{{cite web |url=https://www.python.org/dev/peps/pep-0342/ |title=PEP 342&nbsp;– Coroutines via Enhanced Generators |last1=van Rossum |first1=Guido |last2=Eby |first2=Phillip J. |date=10 May 2005 |work=Python Enhancement Proposals |publisher=Python Software Foundation |accessdate=19 February 2012}}</ref>
<ref name="AutoNT-58">{{cite web |url=https://www.python.org/dev/peps/pep-0380/ |title=PEP 380 |publisher=Python.org |date=|accessdate=3 December 2012}}</ref>
<ref name="AutoNT-59">{{cite web |url=https://www.python.org/dev/peps/pep-0289/ |title=PEP 289&nbsp;– Generator Expressions |last=Hettinger |first=Raymond |date=30 January 2002 |work=Python Enhancement Proposals |publisher=Python Software Foundation |accessdate=19 February 2012}}</ref>
<ref name="AutoNT-60">{{cite web |url=https://www.python.org/dev/peps/pep-0308/ |title=PEP 308&nbsp;– Conditional Expressions |last1=van Rossum |first1=Guido |last2=Hettinger |first2=Raymond |date=7 February 2003 |work=Python Enhancement Proposals |publisher=Python Software Foundation |accessdate=13 July 2011}}</ref>
<ref name="AutoNT-61">{{cite web |url=https://docs.python.org/faq/design.html#why-must-self-be-used-explicitly-in-method-definitions-and-calls |title=Why must 'self' be used explicitly in method definitions and calls? |work=Design and History FAQ |publisher=Python Software Foundation |accessdate=19 February 2012}}</ref>
<ref name="classy">{{cite web |title=The Python Language Reference, section 3.3. New-style and classic classes, for release 2.7.1 |accessdate=12 January 2011 |url=https://docs.python.org/reference/datamodel.html#new-style-and-classic-classes}}</ref>
<ref name="pep0237">{{cite web |url=https://www.python.org/dev/peps/pep-0237/ |title=PEP 237&nbsp;– Unifying Long Integers and Integers |last1=Zadka |first1=Moshe |last2=van Rossum |first2=Guido |date=11 March 2001 |work=Python Enhancement Proposals |publisher=Python Software Foundation |accessdate=24 September 2011}}</ref>
<ref name="AutoNT-62">{{cite web |url=http://python-history.blogspot.com/2010/08/why-pythons-integer-division-floors.html |title=Why Python's Integer Division Floors |accessdate=25 August 2010}}</ref>
<ref name="AutoNT-63">{{citation |url=https://docs.python.org/library/functions.html#round |accessdate=14 August 2011 |title=round |work=The Python standard library, release 2.7, §2: Built-in functions}}</ref>
<ref name="AutoNT-64">{{citation |url=https://docs.python.org/py3k/library/functions.html#round |accessdate=14 August 2011 |title=round |work=The Python standard library, release 3.2, §2: Built-in functions}}</ref>
<ref name="AutoNT-65">Python Essential Reference, David M Beazley</ref>
<ref name="AutoNT-66">{{cite web |url=https://www.python.org/dev/peps/pep-0007/ |title=PEP 7&nbsp;– Style Guide for C Code |last=van Rossum |first=Guido |date=5 June 2001 |work=Python Enhancement Proposals |publisher=Python Software Foundation |accessdate=24 November 2008}}</ref>
<ref name="AutoNT-67">{{cite web |url=https://docs.python.org/lib/bytecodes.html |title=CPython byte code |publisher=Docs.python.org |accessdate=19 April 2011}}</ref>
<ref name="AutoNT-68">{{cite web |url=http://www.troeger.eu/teaching/pythonvm08.pdf |title=Python 2.5 internals |format=PDF |accessdate=19 April 2011}}</ref>
<ref name="AutoNT-69">{{cite web |url=http://www.oreilly.com/pub/a/oreilly/frank/rossum_1099.html |title=An Interview with Guido van Rossum |publisher=Oreilly.com |accessdate=24 November 2008}}</ref>
<ref name="AutoNT-70">{{cite web |url=http://pypy.org/compat.html |title=PyPy compatibility |publisher=Pypy.org |date=|accessdate=3 December 2012}}</ref>
<ref name="AutoNT-71">{{cite web |url=http://speed.pypy.org/ |title=speed comparison between CPython and Pypy |publisher=Speed.pypy.org |date=|accessdate=3 December 2012}}</ref>
<ref name="AutoNT-72">{{cite web |url=http://morepypy.blogspot.be/2012/06/stm-with-threads.html |title=STM with threads |publisher=Morepypy.blogspot.be |date=10 June 2012 |accessdate=3 December 2012}}</ref>
<ref name="AutoNT-73">{{cite web|url=http://doc.pypy.org/en/latest/stackless.html|title=Application-level Stackless features — PyPy 2.0.2 documentation|publisher=Doc.pypy.org|accessdate=17 July 2013}}</ref>
<ref name="AutoNT-74">{{cite web |url=https://code.google.com/p/unladen-swallow/wiki/ProjectPlan |title=Plans for optimizing Python |work=Google Project Hosting |publisher=Google |date=15 December 2009 |accessdate=24 September 2011}}</ref>
<ref name="AutoNT-86">{{cite web |first=Przemyslaw |last=Piotrowski |url=http://www.oracle.com/technetwork/articles/piotrowski-pythoncore-084049.html |title=Build a Rapid Web Development Environment for Python Server Pages and Oracle |work=Oracle Technology Network |publisher=Oracle |date=July 2006 |accessdate=12 March 2012}}</ref>
<ref name="AutoNT-88">{{cite web |url=https://www.python.org/dev/peps/pep-0327/ |title=PEP 327&nbsp;– Decimal Data Type |last=Batista |first=Facundo |date=17 October 2003 |work=Python Enhancement Proposals |publisher=Python Software Foundation |accessdate=24 November 2008}}</ref>
<ref name="AutoNT-89">{{cite web |url=https://www.python.org/dev/peps/pep-0333/ |title=PEP 333&nbsp;– Python Web Server Gateway Interface v1.0 |last=Eby |first=Phillip J. |date=7 December 2003 |work=Python Enhancement Proposals |publisher=Python Software Foundation |accessdate=19 February 2012}}</ref>
<ref name="AutoNT-90">{{cite web |url=http://boo.codehaus.org/Gotchas+for+Python+Users |title=Gotchas for Python Users |work=boo.codehaus.org |publisher=Codehaus Foundation |accessdate=24 November 2008}}</ref>
<ref name="AutoNT-91">{{cite web |url=http://cobra-language.com/docs/acknowledgements/ |title=Acknowledgements |last=Esterbrook |first=Charles |work=cobra-language.com |publisher=Cobra Language |accessdate=7 April 2010}}</ref>
<ref name="AutoNT-92">{{cite web |url=http://cobra-language.com/docs/python/ |title=Comparison to Python |last=Esterbrook |first=Charles |work=cobra-language.com |publisher=Cobra Language |accessdate=7 April 2010}}</ref>
<ref name="AutoNT-93">{{cite web |url=http://wiki.ecmascript.org/doku.php?id=proposals:iterators_and_generators |title=Proposals: iterators and generators [ES4 Wiki&#93; |publisher=wiki.ecmascript.org |accessdate=24 November 2008}}</ref>
<ref name="AutoNT-94">{{ cite news |url=http://www.techcrunch.com/2009/11/10/google-go-language/ |title=Google’s Go: A New Programming Language That’s Python Meets C++ |last=Kincaid |first=Jason |date=10 November 2009 |publisher=TechCrunch |accessdate=29 January 2010}}</ref>
<ref name="AutoNT-95">{{cite web |last=Strachan |first=James |date=29 August 2003 |title=Groovy&nbsp;– the birth of a new dynamic language for the Java platform |url=http://radio.weblogs.com/0112098/2003/08/29.html}}</ref>
<ref name="AutoNT-96">{{cite web |url=http://people.csail.mit.edu/mikelin/ocaml+twt/ |title=The Whitespace Thing for OCaml |last=Lin |first=Mike |publisher=Massachusetts Institute of Technology |accessdate=12 April 2009}}</ref>
<ref name="linuxdevcenter">{{cite web |url=http://www.linuxdevcenter.com/pub/a/linux/2001/11/29/ruby.html |title=An Interview with the Creator of Ruby |publisher=Linuxdevcenter.com |date=|accessdate=3 December 2012}}</ref>
<ref name="AutoNT-99">{{cite web |url=http://www.tcl.tk/cgi-bin/tct/tip/3.html |title=TIP #3: TIP Format |last1=Kupries |first1=Andreas |last2=Fellows |first2=Donal K. |work=tcl.tk |publisher=Tcl Developer Xchange |date=14 September 2000 |accessdate=24 November 2008}}</ref>
<ref name="AutoNT-100">{{cite web |url=http://www.erlang.org/eeps/eep-0001.html |title=EEP 1: EEP Purpose and Guidelines |last1=Gustafsson |first1=Per |last2=Niskanen |first2=Raimo |publisher=erlang.org |date=29 January 2007 |accessdate=19 April 2011}}</ref>
<ref name="AutoNT-101">{{cite web |url=http://www.tiobe.com/index.php/content/paperinfo/tpci/ |title=TIOBE Programming Community Index for March 2012 |date=March 2012 |publisher=TIOBE Software |accessdate=25 March 2012}}</ref>
}}

== Further reading ==
<!-------- THIS IS ''not'' A LIST OF ALL PYTHON BOOKS
According to [[Wikipedia:Further reading]], criteria for inclusion includes:
1. Should clearly qualify as WP:RS, as indicated by reviews and citations to it.
...
5. There should be guidelines on limiting the number of sources.
6. To avoid spam, any book included should have received more than one good review in RS: newspapers and scholarly journals being the norm, and the clear balance of RS reviews should be positive. This would avoid self-publish spamming, POV pushing, and attempts by publishers to get books promoted through inclusion on Wikipedia. At the moment "editorial recommendations" as described in the manual smacks of OR.
7. Neutrality on the part of editors is essential. In terms of major debates, items representing all major positions should be included, with annotations indicating the specific POV of each. We may have to work out rules where topic disputes are irreconcilable.


-->
==References==
* {{cite book |last=Downey |first=Allen B |title=Think Python: How to Think Like a Computer Scientist |edition=Version 1.6.6 |date=May 2012 |isbn=978-0-521-72596-5 |url=http://www.greenteapress.com/thinkpython/html/}}
{{Reflist}}
* {{cite news |url=http://www.computerworld.com.au/index.php/id;66665771 |title=The A-Z of Programming Languages: Python |last=Hamilton |first=Naomi |date=5 August 2008 |work=Computerworld |accessdate=31 March 2010}}
* {{cite book |last=Lutz |first=Mark |title=Learning Python |publisher=O'Reilly Media |year=2013 |edition=5th |isbn=978-0-596-15806-4 |url=http://shop.oreilly.com/product/0636920028154.do}}
* {{cite book |last=Pilgrim |first=Mark |title=Dive Into Python |publisher=Apress |year=2004 |isbn=978-1-59059-356-1 |url=http://diveintopython.net}}
* {{cite book |last=Pilgrim |first=Mark |title=Dive Into Python 3 |publisher=Apress |year=2009 |isbn=978-1-4302-2415-0 |url=http://diveintopython3.net}}
* {{cite book|last=Summerfield|first=Mark|title=Programming in Python 3|publisher=Addison-Wesley Professional|year=2009|edition=2nd|isbn=978-0-321-68056-3|url=http://www.qtrac.eu/py3book.html}}


==External links==
== External links ==
<!-- ======================== {{No more links}} ============================
* [http://www.numdic.com/2 The Number 2]
| PLEASE BE CAUTIOUS IN ADDING MORE LINKS TO THIS ARTICLE. Wikipedia |
* [http://www.positiveintegers.org/2 The Positive Integer 2]
| is not a collection of links nor should it be used for advertising. |
* [http://primes.utm.edu/curios/page.php/2.html Prime curiosities: 2]
| |
| Excessive or inappropriate links WILL BE DELETED. |
| See [[Wikipedia:External links]] & [[Wikipedia:Spam]] for details. |
| |
| If there are already plentiful links, please propose additions or |
| replacements on this article's discussion page, or submit your link |
| to the relevant category at the Open Directory Project (dmoz.org) |
| and link back to that category using the {{Dmoz}} template. |
============================= {{No more links}} ============================ -->
{{Sister project links |wikt=no |commons=Category:Python (programming language) |b=Python Programming |n=no |q=Python |s=no |v=Topic:Python |voy=no |species=no |d=no }}
* {{Official website}}
* {{Usenet|comp.lang.python}}
* [http://python-history.blogspot.co.uk/ The History of Python (blog by Guido van Rossum)]
* [https://mail.python.org/mailman/listinfo/python-list Python development list]
* {{Dmoz|Computers/Programming/Languages/Python|Python}}


{{Programming languages}}
{{Wiktionary|two|both}}
{{Python (programming language)}}
{{Commons and category|2|2 (number)}}
{{Python Web Application Frameworks}}
{{FOSS}}


{{Integers|zero}}
{{Good article}}


[[Category:Class-based programming languages]]
{{DEFAULTSORT:2 (Number)}}
[[Category:2 (number)]]
[[Category:Cross-platform free software]]
[[Category:Integers|02]]
[[Category:Dutch inventions]]
[[Category:Dynamically typed programming languages]]
[[Category:High-level programming languages]]
[[Category:Object-oriented programming languages]]
[[Category:Programming languages created in 1991]]
[[Category:Python (programming language)| ]]
[[Category:Scripting languages]]
[[Category:Text-oriented programming languages]]

Revision as of 02:10, 10 July 2015

Python
Paradigmmulti-paradigm: object-oriented, imperative, functional, procedural, reflective
Designed byGuido van Rossum
DeveloperPython Software Foundation
First appeared1991; 33 years ago (1991)
Stable release
3.4.3 /
25 February 2015 (2015-02-25)[1]
2.7.10 /
23 May 2015 (2015-05-23)[2]
Preview release
3.5.0b3 /
5 July 2015 (2015-07-05)[3]
Typing disciplineduck, dynamic, strong, gradual (as of Python 3.5)[4]
OSCross-platform
LicensePython Software Foundation License
Filename extensions.py, .pyc, .pyd, .pyo, .pyw
Websitewww.python.org
Major implementations
CPython, IronPython, Jython, PyPy
Dialects
Cython, RPython, Stackless Python
Influenced by
ABC,[5] ALGOL 68,[6] C,[7] C++,[8] Dylan,[9] Haskell,[10] Icon,[11] Java,[12] Lisp,[13] Modula-3,[8] Perl
Influenced
Boo, Cobra, D, F#, Falcon, Go, Groovy, JavaScript,[14][15] Julia,[16] Nim, Ruby,[17] Swift[18]

Python is a widely used general-purpose, high-level programming language.[19][20][21] Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in languages such as C++ or Java.[22][23] The language provides constructs intended to enable clear programs on both a small and large scale.[24]

Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library.[25]

Python interpreters are available for installation on many operating systems, allowing Python code execution on a wide variety of systems. Using third-party tools, such as Py2exe or Pyinstaller,[26] Python code can be packaged into stand-alone executable programs for some of the most popular operating systems, allowing for the distribution of Python-based software for use on those environments without requiring the installation of a Python interpreter.

CPython, the reference implementation of Python, is free and open-source software and has a community-based development model, as do nearly all of its alternative implementations. CPython is managed by the non-profit Python Software Foundation.


History

Guido van Rossum, the creator of Python.

Python was conceived in the late 1980s[27] and its implementation was started in December 1989[28] by Guido van Rossum at CWI in the Netherlands as a successor to the ABC language (itself inspired by SETL)[29] capable of exception handling and interfacing with the Amoeba operating system.[5] Van Rossum is Python's principal author, and his continuing central role in deciding the direction of Python is reflected in the title given to him by the Python community, benevolent dictator for life (BDFL).

About the origin of Python, Van Rossum wrote in 1996:[30]

Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office ... would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus).

Python 2.0 was released on 16 October 2000, and included many major new features including a full garbage collector and support for Unicode. With this release the development process was changed and became more transparent and community-backed.[31]

Python 3.0 (also called Python 3000 or py3k), a major, backwards-incompatible release, was released on 3 December 2008[32] after a long period of testing. Many of its major features have been backported to the backwards-compatible Python 2.6 and 2.7.[33]

Features and philosophy

Python is a multi-paradigm programming language: object-oriented programming and structured programming are fully supported, and there are a number of language features which support functional programming and aspect-oriented programming (including by metaprogramming[34] and by magic methods).[35] Many other paradigms are supported using extensions, including design by contract[36][37] and logic programming.[38]

Python uses dynamic typing and a combination of reference counting and a cycle-detecting garbage collector for memory management. An important feature of Python is dynamic name resolution (late binding), which binds method and variable names during program execution.

The design of Python offers some support for functional programming in the Lisp tradition. The language has map(), reduce() and filter() functions; comprehensions for lists, dictionaries, and sets; and generator expressions.[39] The standard library has two modules (itertools and functools) that implement functional tools borrowed from Haskell and Standard ML.[40]

The core philosophy of the language is summarized by the document "PEP 20 (The Zen of Python)", which includes aphorisms such as:[41]

  • Beautiful is better than ugly
  • Explicit is better than implicit
  • Simple is better than complex
  • Complex is better than complicated
  • Readability counts

Rather than requiring all desired functionality to be built into the language's core, Python was designed to be highly extensible. Python can also be embedded in existing applications that need a programmable interface. This design of a small core language with a large standard library and an easily extensible interpreter was intended by Van Rossum from the very start because of his frustrations with ABC (which espoused the opposite mindset).[27]

While offering choice in coding methodology, the Python philosophy rejects exuberant syntax, such as in Perl, in favor of a sparser, less-cluttered grammar. As Alex Martelli put it: "To describe something as clever is not considered a compliment in the Python culture."[42] Python's philosophy rejects the Perl "there is more than one way to do it" approach to language design in favor of "there should be one—and preferably only one—obvious way to do it".[41]

Python's developers strive to avoid premature optimization, and moreover, reject patches to non-critical parts of CPython which would offer a marginal increase in speed at the cost of clarity.[43] When speed is important, Python programmers use PyPy, a just-in-time compiler, or move time-critical functions to extension modules written in languages such as C. Cython is also available which translates a Python script into C and makes direct C level API calls into the Python interpreter.

An important goal of the Python developers is making Python fun to use. This is reflected in the origin of the name which comes from Monty Python,[44] and in an occasionally playful approach to tutorials and reference materials, such as using examples that refer to spam and eggs instead of the standard foo and bar.[45][46]

A common neologism in the Python community is pythonic, which can have a wide range of meanings related to program style. To say that code is pythonic is to say that it uses Python idioms well, that it is natural or shows fluency in the language, that it conforms with Python's minimalist philosophy and emphasis on readability. In contrast, code that is difficult to understand or reads like a rough transcription from another programming language is called unpythonic.

Users and admirers of Python—especially those considered knowledgeable or experienced—are often referred to as Pythonists, Pythonistas, and Pythoneers.[47][48]

Syntax and semantics

Python is intended to be a highly readable language. It is designed to have an uncluttered visual layout, frequently using English keywords where other languages use punctuation. Furthermore, Python has a smaller number of syntactic exceptions and special cases than C or Pascal.[49]

Indentation

Python uses whitespace indentation, rather than curly braces or keywords, to delimit blocks; this feature is also termed the off-side rule. An increase in indentation comes after certain statements; a decrease in indentation signifies the end of the current block.[50]

Statements and control flow

Python's statements include (among others):

  • The if statement, which conditionally executes a block of code, along with else and elif (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 by except clauses; it also ensures that clean-up code in a finally block will always be run regardless of how the block exits.
  • 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 (from Python 2.5), 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 RAII-like behavior.
  • 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 ought to apply.
  • The yield statement, which returns a value from a generator function. From Python 2.5, yield is also an operator. This form is used to implement coroutines.
  • The import statement, which is used to import modules whose functions or variables can be used in the current program.
  • The print statement was changed to the print() function in Python 3.[51]

Python does not support tail-call optimization or first-class continuations, and, according to Guido van Rossum, it never will.[52][53] However, better support for coroutine-like functionality is provided in 2.5, by extending Python's generators.[54] Prior to 2.5, generators were lazy iterators; information was passed unidirectionally out of the generator. As of Python 2.5, it is possible to pass information back into a generator function, and as of Python 3.3, the information can be passed through multiple stack levels.[55]

Expressions

Python expressions are similar to languages such as C and Java:

  • Addition, subtraction, and multiplication are the same, but the behavior of division differs (see Mathematics for details). Python also added the ** operator for exponentiation.
  • In Python, == compares by value, in contrast to Java, where it compares by reference. (Value comparisons in Java use the equals() method.) Python's is operator may be used to compare object identities (comparison by reference). Comparisons may be chained, for example a <= b <= c.
  • Python uses the words and, or, not for its boolean operators rather than the symbolic &&, ||, ! used in Java and C.
  • Python has a type of expression termed a list comprehension. Python 2.4 extended list comprehensions into a more general expression termed a generator expression.[39]
  • Anonymous functions are implemented using lambda expressions; however, these are limited in that the body can only be a single expression.
  • Conditional expressions in Python are written as x if c else y[56] (different in order of operands from the ?: operator common to many other languages).
  • Python makes a distinction between lists and tuples. Lists are written as [1, 2, 3], are mutable, and cannot be used as the keys of dictionaries (dictionary keys must be immutable in Python). Tuples are written as (1, 2, 3), are immutable and thus can be used as the keys of dictionaries, provided all elements of the tuple are immutable. The parentheses around the tuple are optional in some contexts. Tuples can appear on the left side of an equal sign; hence a statement like x, y = y, x can be used to swap two variables.
  • Python has a "string format" operator %. This functions analogous to printf format strings in C, e.g. "foo=%s bar=%d" % ("blah", 2) evaluates to "foo=blah bar=2". In Python 3 and 2.6+, this was supplemented by the format() method of the str class, e.g. "foo={0} bar={1}".format("blah", 2).
  • Python has various kinds of string literals:
    • Strings delimited by single or double quotation marks. Unlike in Unix shells, Perl and Perl-influenced languages, single quotation marks and double quotation marks function identically. Both kinds of string use the backslash (\) as an escape character and there is no implicit string interpolation such as "$foo".
    • Triple-quoted strings, which begin and end with a series of three single or double quotation marks. They may span multiple lines and function like here documents in shells, Perl and Ruby.
    • Raw string varieties, denoted by prefixing the string literal with an r. No escape sequences are interpreted; hence raw strings are useful where literal backslashes are common, such as regular expressions and Windows-style paths. Compare "@-quoting" in C#.
  • Python has index and slice expressions on lists, denoted as a[key], a[start:stop] or a[start:stop:step]. Indexes are zero-based, and negative indexes are relative to the end. Slices take elements from the start index up to, but not including, the stop index. The third slice parameter, called step or stride, allows elements to be skipped and reversed. Slice indexes may be omitted, for example a[:] returns a copy of the entire list. Each element of a slice is a shallow copy.

In Python, a distinction between expressions and statements is rigidly enforced, in contrast to languages such as Common Lisp, Scheme, or Ruby. This leads to some duplication of functionality. For example:

  • 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 cannot be a part of an expression, so list and other comprehensions or lambda expressions, all being expressions, cannot contain statements. A particular case of this is that an assignment statement such as a = 1 cannot form part of the conditional expression of a conditional statement. This has the advantage of avoiding a classic C error of mistaking an assignment operator = for an equality operator == in conditions: if (c = 1) { ... } is valid C code but if c = 1: ... causes a syntax error in Python.

Methods

Methods on objects are functions attached to the object's class; the syntax instance.method(argument) is, for normal methods and functions, syntactic sugar for Class.method(instance, argument). Python methods have an explicit self parameter to access instance data, in contrast to the implicit self (or this) in some other object-oriented programming languages (e.g. C++, Java, Objective-C, or Ruby).[57]

Typing

Python uses duck typing and has typed objects but untyped variable names. Type constraints are not checked at compile time; 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 number to a string) rather than silently attempting to make sense of them.

Python allows programmers to define their own types using classes, which are most often used for object-oriented programming. New instances of classes are constructed by calling the class (for example, SpamClass() or EggsClass()), and the classes themselves are instances of the metaclass type (itself an instance of itself), allowing metaprogramming and reflection.

Prior to version 3.0, Python had two kinds of classes: "old-style" and "new-style".[58] Old-style classes were eliminated in Python 3.0, making all classes new-style. In versions between 2.2 and 3.0, both kinds of classes could be used. The syntax of both styles is the same, the difference being whether the class object is inherited from, directly or indirectly (all new-style classes inherit from object and are instances of type).

Summary of Python 3's built-in types
Type Description Syntax example
str A character string: an immutable sequence of Unicode codepoints. 'Wikipedia'
"Wikipedia"
"""Spanning
multiple
lines"""
bytearray A mutable sequence of bytes. bytearray(b'Some ASCII')
bytearray(b"Some ASCII")
bytearray([119, 105, 107, 105])
bytes An immutable sequence of bytes. b'Some ASCII'
b"Some ASCII"
bytes([119, 105, 107, 105])
list Mutable list, can contain mixed types. [4.0, 'string', True]
tuple Immutable, can contain mixed types. (4.0, 'string', True)
set, frozenset Unordered set, contains no duplicates.
A frozenset is immutable.
Either can contain mixed types as long as they are hashable.
{4.0, 'string', True}
frozenset([4.0, 'string', True])
dict A 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}
int An immutable integer of unlimited magnitude.[59] 42
float An immutable floating point number (system-defined precision). 3.1415927
complex An immutable complex number with real and imaginary parts. 3+2.7j
bool An immutable boolean value. True
False
ellipsis An ellipsis placeholder to be used as an index in NumPy arrays. ...

Mathematics

Python has the usual C arithmetic operators (+, -, *, /, %). It also has ** for exponentiation, e.g. 5**3 == 125 and 9**.5 == 3.0 and a new matrix multiply operator @ coming in 3.5.[60]

The behavior of division has changed significantly over time.[61]

  • Python 2.1 and earlier use the C 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.
  • Python 2.2 changes integer division to round towards negative infinity, e.g. 7 / 3 == 2 and -7 / 3 == -3. The floor division // operator is introduced. So 7 // 3 == 2, -7 // 3 == -3, 7.5 // 3 == 2.0 and -7.5 // 3 == -3.0. Adding from __future__ import division causes a module to use Python 3.0 rules for division (see next).
  • Python 3.0 changes / to always be floating point division. In Python terms, the pre-3.0 / is "classic division", the 3.0 / is "real division", and // is "floor division".

Rounding towards negative infinity, though different from most languages, adds consistency. For instance, it means that the equation (a+b) // b == a // b + 1 is always true. It also means that the equation b * (a // b) + a % b == a is valid for both positive and negative 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 interval [0,b), where b is a positive integer, it has to lie in the interval (b,0] when b is negative.[62]

Python provides a round function for rounding floats to integers. Versions before 3 use round-away-from-zero: round(0.5) is 1.0, round(-0.5) is −1.0.[63] Python 3 uses round-to-even: round(1.5) is 2, round(2.5) is 2.[64] The Decimal type/class in module decimal (since version 2.4) provides exact numerical representation and several rounding modes.

Python allows boolean expressions with multiple equality relations in a manner that is consistent with general usage in mathematics. For example, the expression a < b < c tests whether a is less than b and b is less than c. C-derived languages interpret this expression differently: in C, the expression would first evaluate a < b, resulting in 0 or 1, and that result would then be compared with c.[65][page needed]

Due to Python's extensive mathematics library, it is frequently used as a scientific scripting language to aid in problems such as data processing and manipulation.

Libraries

Python has a large standard library, commonly cited as one of Python's greatest strengths,[66] providing tools suited to many tasks. This is deliberate and has been described as a "batteries included"[25] Python philosophy. For Internet-facing applications, a large number of standard formats and protocols (such as MIME and HTTP) are supported. Modules for creating graphical user interfaces, connecting to relational databases, pseudorandom number generators, arithmetic with arbitrary precision decimals,[67] manipulating regular expressions, and doing unit testing are also included.

Some parts of the standard library are covered by specifications (for example, the WSGI implementation wsgiref follows PEP 333[68]), but the majority of the modules are not. They are specified by their code, internal documentation, and test suite (if supplied). However, because most of the standard library is cross-platform Python code, there are only a few modules that must be altered or completely rewritten by alternative implementations.

The standard library is not essential to run Python or embed Python within an application. Blender 2.49, for instance, omits most of the standard library.

As of January 2015, the Python Package Index, the official repository of third-party software for Python, contains more than 54,000 packages offering a wide range of functionality, including:

  • graphical user interfaces, web frameworks, multimedia, databases, networking and communications
  • test frameworks, automation and web scraping, documentation tools, system administration
  • scientific computing, text processing, image processing

Development environments

Most Python implementations (including CPython) can function as a command line interpreter, for which the user enters statements sequentially and receives the results immediately (REPL). In short, Python acts as a shell.

Other shells add capabilities beyond those in the basic interpreter, including IDLE and IPython. While generally following the visual style of the Python shell, they implement features like auto-completion, retention of session state, and syntax highlighting.

In addition to standard desktop Python IDEs (integrated development environments), there are also browser-based IDEs, Sage (intended for developing science and math-related Python programs), and a browser-based IDE and hosting environment, PythonAnywhere.

Implementations

The main Python implementation, named CPython, is written in C meeting the C89 standard.[69] It compiles Python programs into intermediate bytecode,[70] which is executed by the virtual machine.[71] CPython is distributed with a large standard library written in a mixture of C and Python. It is available in versions for many platforms, including Microsoft Windows and most modern Unix-like systems. CPython was intended from almost its very conception to be cross-platform.[72]

PyPy is a fast, compliant[73] interpreter of Python 2.7 and 3.2. Its just-in-time compiler brings a significant speed improvement over CPython.[74] A version taking advantage of multi-core processors using software transactional memory is being created.[75]

Stackless Python is a significant fork of CPython that implements microthreads; it does not use the C memory stack, thus allowing massively concurrent programs. PyPy also has a stackless version.[76]

Other just-in-time compilers have been developed in the past, but are now unsupported:

  • Google started a project called Unladen Swallow in 2009 with the aims of increasing the speed of the Python interpreter by 5 times by using the LLVM and improving its multithreading ability to scale to thousands of cores.[77]
  • Psyco is a specialising just in time compiler that integrates with CPython and transforms bytecode to machine code at runtime. The produced code is specialised for certain data types and is faster than standard Python code.

In 2005, Nokia released a Python interpreter for the Series 60 mobile phones called PyS60. It includes many of the modules from the CPython implementations and some additional modules for integration with the Symbian operating system. This project has been kept up to date to run on all variants of the S60 platform and there are several third party modules available. The Nokia N900 also supports Python with GTK widget libraries, with the feature that programs can be both written and run on the device itself.[78]

There are several compilers to high-level object languages, with either unrestricted Python, a restricted subset of Python, or a language similar to Python as the source language:

A performance comparison of various Python implementations on a non-numerical (combinatorial) workload was presented at EuroSciPy '13.[79]

Development

Python's development is conducted largely through the Python Enhancement Proposal (PEP) process. The PEP process is the primary mechanism for proposing major new features, for collecting community input on an issue, and for documenting the design decisions that have gone into Python.[80] Outstanding PEPs are reviewed and commented upon by the Python community and by Van Rossum, the Python project's BDFL.[80]

Enhancement of the language goes along with development of the CPython reference implementation. The mailing list python-dev is the primary forum for discussion about the language's development; specific issues are discussed in the Roundup bug tracker maintained at python.org.[81] Development takes place on a self-hosted source code repository running Mercurial.[82]

CPython's public releases come in three types, distinguished by which part of the version number is incremented:

  • Backwards-incompatible versions, where code is expected to break and must be manually ported. The first part of the version number is incremented. These releases happen infrequently—for example, version 3.0 was released 8 years after 2.0.
  • Major or "feature" releases, which are largely compatible but introduce new features. The second part of the version number is incremented. These releases are scheduled to occur roughly every 18 months, and each major version is supported by bugfixes for several years after its release.[83]
  • Bugfix releases, which introduce no new features but fix bugs. The third and final part of the version number is incremented. These releases are made whenever a sufficient number of bugs have been fixed upstream since the last release, or roughly every 3 months. Security vulnerabilities are also patched in bugfix releases.[84]

A number of alpha, beta, and release-candidates are also released as previews and for testing before the final release is made. Although there is a rough schedule for each release, this is often pushed back if the code is not ready. The development team monitor the state of the code by running the large unit test suite during development, and using the BuildBot continuous integration system.[85]

The community of Python developers has also contributed over 58,000 software modules (as of May 2, 2015) to the Python Package Index (called PyPI), the official repository of third-party libraries for Python.

The major academic conference on Python is named PyCon. There are special mentoring programmes like the Pyladies.

Naming

Python's name is derived from the television series Monty Python's Flying Circus,[86] and it is common to use Monty Python references in example code.[87] For example, the metasyntactic variables often used in Python literature are spam and eggs, instead of the traditional foo and bar.[87][88] As well as this, the official Python documentation often contains various obscure Monty Python references.

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 (commonly used to create games); PyS60, an implementation for the Symbian S60 operating system; PyQt and PyGTK, which bind Qt and GTK, respectively, to Python; and PyPy, a Python implementation originally written in Python.

Use

Since 2008, Python has consistently ranked in the top eight most popular programming languages as measured by the TIOBE Programming Community Index.[19] It is the third most popular language whose grammatical syntax is not predominantly based on C, e.g. C++, C#, Objective-C, Java.

An empirical study found scripting languages (such as Python) more productive than conventional languages (such as C and Java) for a programming problem involving string manipulation and search in a dictionary. Memory consumption was often "better than Java and not much worse than C or C++".[89]

Large organizations that make use of Python include Google,[90] Yahoo!,[91] CERN,[92] NASA,[93] and some smaller ones like ILM,[94] and ITA.[95]

Python can serve as a scripting language for web applications, e.g., via mod_wsgi for the Apache web server.[96] With Web Server Gateway Interface, a standard API has evolved to facilitate these applications. Web application frameworks like Django, Pylons, Pyramid, TurboGears, web2py, Tornado, Flask and Zope support developers in the design and maintenance of complex applications. Pyjamas and IronPython can be used to develop the client-side of Ajax-based applications. SQLAlchemy can be used as data mapper to a relational database. Twisted is a framework to program communications between computers, and is used (for example) by Dropbox.

Libraries like NumPy, SciPy and Matplotlib allow the effective use of Python in scientific computing,[97][98] with specialized libraries such as BioPython and Astropy providing domain-specific functionality. Sage is a mathematical software with a "notebook" programmable in Python: its library covers many aspects of mathematics, including algebra, combinatorics, numerical mathematics, number theory, and calculus.

Python has been successfully embedded in a number of software products as a scripting language, including in finite element 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 visual effects compositor Nuke, 2D imaging programs like GIMP,[99] Inkscape, Scribus and Paint Shop Pro,[100] and musical notation program or scorewriter capella. 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.[101] It has also been used in several video games,[102][103] and has been adopted as first of the three available programming languages in Google App Engine, the other two being Java and Go.[104]

Python has also been used in artificial intelligence tasks.[105][106][107][108] As a scripting language with module architecture, simple syntax and rich text processing tools, Python is often used for natural language processing tasks.[109]

Many operating systems include Python as a standard component; the language ships with most Linux distributions, AmigaOS 4, FreeBSD, NetBSD, OpenBSD and OS X, and can be used from the terminal. A number of Linux distributions use installers written in Python: Ubuntu uses the Ubiquity installer, while Red Hat Linux and Fedora use the Anaconda installer. Gentoo Linux uses Python in its package management system, Portage.

Python has also seen extensive use in the information security industry, including in exploit development.[110][111]

Most of the Sugar software for the One Laptop per Child XO, now developed at Sugar Labs, is written in Python.[112]

The Raspberry Pi single-board computer project has adopted Python as its principal user-programming language.

LibreOffice includes Python and intends to replace Java with Python. Python Scripting Provider is a core feature[113] since Version 4.0 from 7 February 2013.

Languages influenced by Python

Python's design and philosophy have influenced several programming languages, including:

Python's development practices have also been emulated by other languages. The practice of requiring a document describing the rationale for, and issues surrounding, a change to the language (in Python's case, a PEP) is also used in Tcl[123] and Erlang[124] because of Python's influence.

Python has been awarded a TIOBE Programming Language of the Year award twice (in 2007 and 2010), which is given to the language with the greatest growth in popularity over the course of a year, as measured by the TIOBE index.[125]

See also

References

  1. ^ "Python 3.4.3". Python Software Foundation. Retrieved 27 February 2015.
  2. ^ "Python 2.7.10 Release". Python Software Foundation. Retrieved 24 May 2015.
  3. ^ "Python Release Python 3.5.0b3". Python Software Foundation. Retrieved 9 July 2015.
  4. ^ "Type hinting for Python". LWN.net. 24 December 2014. Retrieved 5 May 2015.
  5. ^ a b "Why was Python created in the first place?". General Python FAQ. Python Software Foundation. Retrieved 22 March 2007.
  6. ^ Kuchling, Andrew M. (22 December 2006). "Interview with Guido van Rossum (July 1998)". amk.ca. Retrieved 12 March 2012.
  7. ^ van Rossum, Guido (1993). "An Introduction to Python for UNIX/C Programmers". Proceedings of the NLUUG najaarsconferentie (Dutch UNIX users group). even though the design of C is far from ideal, its influence on Python is considerable.
  8. ^ a b "Classes". The Python Tutorial. Python Software Foundation. Retrieved 20 February 2012. It is a mixture of the class mechanisms found in C++ and Modula-3
  9. ^ Simionato, Michele. "The Python 2.3 Method Resolution Order". Python Software Foundation. The C3 method itself has nothing to do with Python, since it was invented by people working on Dylan and it is described in a paper intended for lispers
  10. ^ Kuchling, A. M. "Functional Programming HOWTO". Python v2.7.2 documentation. Python Software Foundation. Retrieved 9 February 2012.
  11. ^ Schemenauer, Neil; Peters, Tim; Hetland, Magnus Lie (18 May 2001). "PEP 255 – Simple Generators". Python Enhancement Proposals. Python Software Foundation. Retrieved 9 February 2012.
  12. ^ Smith, Kevin D.; Jewett, Jim J.; Montanaro, Skip; Baxter, Anthony (2 September 2004). "PEP 318 – Decorators for Functions and Methods". Python Enhancement Proposals. Python Software Foundation. Retrieved 24 February 2012.
  13. ^ "More Control Flow Tools". Python 3 documentation. Python Software Foundation. Retrieved 5 August 2012.
  14. ^ "Perl and Python influences in JavaScript". www.2ality.com. 24 February 2013. Retrieved 15 May 2015. {{cite web}}: External link in |website= (help)
  15. ^ Rauschmayer, Axel. "Chapter 3: Tha Nature of JavaScript; Influences". O'Reilly, Speaking JavaScript. Retrieved 15 May 2015.
  16. ^ "Why We Created Julia". Julia website. February 2012. Retrieved 5 June 2014.
  17. ^ Bini, Ola (2007). Practical JRuby on Rails Web 2.0 Projects: bringing Ruby on Rails to the Java platform. Berkeley: APress. p. 3. ISBN 978-1-59059-881-8.
  18. ^ Lattner, Chris (3 June 2014). "Chris Lattner's Homepage". Chris Lattner. Retrieved 3 June 2014. The Swift language is the product of tireless effort from a team of language experts, documentation gurus, compiler optimization ninjas, and an incredibly important internal dogfooding group who provided feedback to help refine and battle-test ideas. Of course, it also greatly benefited from the experiences hard-won by many other languages in the field, drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list.
  19. ^ a b TIOBE Software Index (2012). "TIOBE Programming Community Index Python". Retrieved 15 October 2012.
  20. ^ "Programming Language Trends - O'Reilly Radar". Radar.oreilly.com. 2 August 2006. Retrieved 17 July 2013.
  21. ^ "The RedMonk Programming Language Rankings: January 2013 – tecosystems". Redmonk.com. 28 February 2013. Retrieved 17 July 2013.
  22. ^ Summerfield, Mark. Rapid GUI Programming with Python and Qt. Python is a very expressive language, which means that we can usually write far fewer lines of Python code than would be required for an equivalent application written in, say, C++ or Java
  23. ^ McConnell, Steve (30 November 2009). Code Complete, p. 100. ISBN 9780735636972.
  24. ^ Kuhlman, Dave. "A Python Book: Beginning Python, Advanced Python, and Python Exercises".
  25. ^ a b "About Python". Python Software Foundation. Retrieved 24 April 2012., second section "Fans of Python use the phrase "batteries included" to describe the standard library, which covers everything from asynchronous processing to zip files."
  26. ^ "PyInstaller Home Page". Retrieved 27 January 2014.
  27. ^ a b Venners, Bill (13 January 2003). "The Making of Python". Artima Developer. Artima. Retrieved 22 March 2007.
  28. ^ van Rossum, Guido (20 January 2009). "A Brief Timeline of Python". The History of Python. Google. Retrieved 20 January 2009.
  29. ^ van Rossum, Guido (29 August 2000). "SETL (was: Lukewarm about range literals)". Python-Dev (Mailing list). Retrieved 13 March 2011. {{cite mailing list}}: Unknown parameter |mailinglist= ignored (|mailing-list= suggested) (help)
  30. ^ van Rossum, Guido (1996). "Foreword for "Programming Python" (1st ed.)". Retrieved 10 July 2014.
  31. ^ Kuchling, A. M.; Zadka, Moshe (16 October 2000). "What's New in Python 2.0". Python Software Foundation. Retrieved 11 February 2012.
  32. ^ "Python 3.0 Release". Python Software Foundation. Retrieved 8 July 2009.
  33. ^ van Rossum, Guido (5 April 2006). "PEP 3000 – Python 3000". Python Enhancement Proposals. Python Software Foundation. Retrieved 27 June 2009.
  34. ^ The Cain Gang Ltd. "Python Metaclasses: Who? Why? When?". Archived from the original (PDF) on 10 December 2009. Retrieved 27 June 2009.
  35. ^ "3.3. Special method names". The Python Language Reference. Python Software Foundation. Retrieved 27 June 2009.
  36. ^ "PyDBC: method preconditions, method postconditions and class invariants for Python". Retrieved 24 September 2011.
  37. ^ "Contracts for Python". Retrieved 24 September 2011.
  38. ^ "PyDatalog". Retrieved 22 July 2012.
  39. ^ a b Hettinger, Raymond (30 January 2002). "PEP 289 – Generator Expressions". Python Enhancement Proposals. Python Software Foundation. Retrieved 19 February 2012.
  40. ^ "6.5 itertools – Functions creating iterators for efficient looping". Docs.python.org. Retrieved 24 November 2008.
  41. ^ a b Peters, Tim (19 August 2004). "PEP 20 – The Zen of Python". Python Enhancement Proposals. Python Software Foundation. Retrieved 24 November 2008.
  42. ^ Alex Martelli, Python Cookbook (2nd ed., p. 230)
  43. ^ "Python Culture".
  44. ^ "General Python FAQ - Why is it called Python?".
  45. ^ "15 Ways Python Is a Powerful Force on the Web".
  46. ^ "pprint - Data pretty printer - Python Documentation".
  47. ^ Goodger, David. "Code Like a Pythonista: Idiomatic Python".
  48. ^ "How to think like a Pythonista".
  49. ^ "Is Python a good language for beginning programmers?". General Python FAQ. Python Software Foundation. Retrieved 21 March 2007.
  50. ^ "Myths about indentation in Python". Secnetix.de. Retrieved 19 April 2011.
  51. ^ Sweigart, Al (2010). "Appendix A: Differences Between Python 2 and 3". Invent Your Own Computer Games with Python (2 ed.). ISBN 978-0-9821060-1-3. Retrieved 20 February 2014.
  52. ^ van Rossum, Guido (22 April 2009). "Tail Recursion Elimination". Neopythonic.blogspot.be. Retrieved 3 December 2012.
  53. ^ van Rossum, Guido (9 February 2006). "Language Design Is Not Just Solving Puzzles". Artima forums. Artima. Retrieved 21 March 2007.
  54. ^ van Rossum, Guido; Eby, Phillip J. (10 May 2005). "PEP 342 – Coroutines via Enhanced Generators". Python Enhancement Proposals. Python Software Foundation. Retrieved 19 February 2012.
  55. ^ "PEP 380". Python.org. Retrieved 3 December 2012.
  56. ^ van Rossum, Guido; Hettinger, Raymond (7 February 2003). "PEP 308 – Conditional Expressions". Python Enhancement Proposals. Python Software Foundation. Retrieved 13 July 2011.
  57. ^ "Why must 'self' be used explicitly in method definitions and calls?". Design and History FAQ. Python Software Foundation. Retrieved 19 February 2012.
  58. ^ "The Python Language Reference, section 3.3. New-style and classic classes, for release 2.7.1". Retrieved 12 January 2011.
  59. ^ Zadka, Moshe; van Rossum, Guido (11 March 2001). "PEP 237 – Unifying Long Integers and Integers". Python Enhancement Proposals. Python Software Foundation. Retrieved 24 September 2011.
  60. ^ "PEP 465 -- A dedicated infix operator for matrix multiplication". python.org.
  61. ^ Zadka, Moshe; van Rossum, Guido (11 March 2001). "PEP 238 – Changing the Division Operator". Python Enhancement Proposals. Python Software Foundation. Retrieved 23 October 2013.
  62. ^ "Why Python's Integer Division Floors". Retrieved 25 August 2010.
  63. ^ "round", The Python standard library, release 2.7, §2: Built-in functions, retrieved 14 August 2011
  64. ^ "round", The Python standard library, release 3.2, §2: Built-in functions, retrieved 14 August 2011
  65. ^ Python Essential Reference, David M Beazley
  66. ^ Piotrowski, Przemyslaw (July 2006). "Build a Rapid Web Development Environment for Python Server Pages and Oracle". Oracle Technology Network. Oracle. Retrieved 12 March 2012.
  67. ^ Batista, Facundo (17 October 2003). "PEP 327 – Decimal Data Type". Python Enhancement Proposals. Python Software Foundation. Retrieved 24 November 2008.
  68. ^ Eby, Phillip J. (7 December 2003). "PEP 333 – Python Web Server Gateway Interface v1.0". Python Enhancement Proposals. Python Software Foundation. Retrieved 19 February 2012.
  69. ^ van Rossum, Guido (5 June 2001). "PEP 7 – Style Guide for C Code". Python Enhancement Proposals. Python Software Foundation. Retrieved 24 November 2008.
  70. ^ "CPython byte code". Docs.python.org. Retrieved 19 April 2011.
  71. ^ "Python 2.5 internals" (PDF). Retrieved 19 April 2011.
  72. ^ "An Interview with Guido van Rossum". Oreilly.com. Retrieved 24 November 2008.
  73. ^ "PyPy compatibility". Pypy.org. Retrieved 3 December 2012.
  74. ^ "speed comparison between CPython and Pypy". Speed.pypy.org. Retrieved 3 December 2012.
  75. ^ "STM with threads". Morepypy.blogspot.be. 10 June 2012. Retrieved 3 December 2012.
  76. ^ "Application-level Stackless features — PyPy 2.0.2 documentation". Doc.pypy.org. Retrieved 17 July 2013.
  77. ^ "Plans for optimizing Python". Google Project Hosting. Google. 15 December 2009. Retrieved 24 September 2011.
  78. ^ "Python on the Nokia N900". Stochastic Geometry.
  79. ^ Murri, Riccardo (2013). Performance of Python runtimes on a non-numeric scientific code. European Conference on Python in Science (EuroSciPy).
  80. ^ a b Warsaw, Barry; Hylton, Jeremy; Goodger, David (13 June 2000). "PEP 1 – PEP Purpose and Guidelines". Python Enhancement Proposals. Python Software Foundation. Retrieved 19 April 2011.
  81. ^ Cannon, Brett. "Guido, Some Guys, and a Mailing List: How Python is Developed". python.org. Python Software Foundation. Retrieved 27 June 2009.
  82. ^ "Python Developer's Guide".
  83. ^ Norwitz, Neal (8 April 2002). "[Python-Dev] Release Schedules (was Stability & change)". Retrieved 27 June 2009.
  84. ^ Aahz; Baxter, Anthony (15 March 2001). "PEP 6 – Bug Fix Releases". Python Enhancement Proposals. Python Software Foundation. Retrieved 27 June 2009.
  85. ^ "Python Buildbot". Python Developer’s Guide. Python Software Foundation. Retrieved 24 September 2011.
  86. ^ "General Python FAQ". Python v2.7.3 documentation. Docs.python.org. Retrieved 3 December 2012.
  87. ^ a b "Whetting Your Appetite". The Python Tutorial. Python Software Foundation. Retrieved 20 February 2012.
  88. ^ "In Python, should I use else after a return in an if block?". Stack Overflow. Stack Exchange. 17 February 2011. Retrieved 6 May 2011.
  89. ^ Prechelt, Lutz (14 March 2000). "An empirical comparison of C, C++, Java, Perl, Python, Rexx, and Tcl" (PDF). Bibliography of Lutz Prechelt. Retrieved 30 August 2013. {{cite web}}: External link in |work= (help)
  90. ^ "Quotes about Python". Python Software Foundation. Retrieved 8 January 2012.
  91. ^ "Organizations Using Python". Python Software Foundation. Retrieved 15 January 2009.
  92. ^ "Python : the holy grail of programming". CERN Bulletin (31/2006). CERN Publications. 31 July 2006. Retrieved 11 February 2012.
  93. ^ Shafer, Daniel G. (17 January 2003). "Python Streamlines Space Shuttle Mission Design". Python Software Foundation. Retrieved 24 November 2008.
  94. ^ Fortenberry, Tim (17 January 2003). "Industrial Light & Magic Runs on Python". Python Software Foundation. Retrieved 11 February 2012.
  95. ^ Taft, Darryl K. (5 March 2007). "Python Slithers into Systems". eWeek.com. Ziff Davis Holdings. Retrieved 24 September 2011.
  96. ^ "Usage statistics and market share of Python for websites". 2012. Retrieved 18 December 2012.
  97. ^ Oliphant, Travis (2007). "Python for Scientific Computing". Computing in Science and Engineering.
  98. ^ Millman, K. Jarrod; Aivazis, Michael (2011). "Python for Scientists and Engineers". Computing in Science and Engineering. 13 (2): 9–12.
  99. ^ "Installers for GIMP for Windows - Frequently Asked Questions". 26 July 2013. Retrieved 26 July 2013.
  100. ^ "jasc psp9components".[dead link]
  101. ^ "About getting started with writing geoprocessing scripts". ArcGIS Desktop Help 9.2. Environmental Systems Research Institute. 17 November 2006. Retrieved 11 February 2012.
  102. ^ CCP porkbelly (24 August 2010). "Stackless Python 2.7". EVE Community Dev Blogs. CCP Games. As you may know, EVE has at its core the programming language known as Stackless Python.
  103. ^ Caudill, Barry (20 September 2005). "Modding Sid Meier's Civilization IV". Sid Meier's Civilization IV Developer Blog. Firaxis Games. Archived from the original on 10 August 2010. we created three levels of tools ... The next level offers Python and XML support, letting modders with more experience manipulate the game world and everything in it.
  104. ^ "Python Language Guide (v1.0)". Google Documents List Data API v1.0. Google. Archived from the original on 10 August 2010.
  105. ^ "Python for Artificial Intelligence". Wiki.python.org. 19 July 2012. Retrieved 3 December 2012.[dead link]
  106. ^ Paine, Jocelyn, ed. (August 2005). "AI in Python". AI Expert Newsletter. Amzi!. Retrieved 11 February 2012.
  107. ^ "PyAIML 0.8.5 : Python Package Index". Pypi.python.org. Retrieved 17 July 2013.
  108. ^ Russell, Stuart J.; Norvig, Peter (2009). Artificial Intelligence: A Modern Approach (3rd ed.). Upper Saddle River, NJ: Prentice Hall. p. 1062. ISBN 978-0-13-604259-4. Retrieved 11 February 2012. {{cite book}}: Unknown parameter |lastauthoramp= ignored (|name-list-style= suggested) (help)
  109. ^ "Natural Language Toolkit".
  110. ^ "Immunity: Knowing You're Secure".
  111. ^ "Corelabs site".
  112. ^ "What is Sugar?". Sugar Labs. Retrieved 11 February 2012.
  113. ^ "4.0 New Features and Fixes". LibreOffice.org. The Document Foundation. 2013. Retrieved 25 February 2013.
  114. ^ "Gotchas for Python Users". boo.codehaus.org. Codehaus Foundation. Retrieved 24 November 2008.
  115. ^ Esterbrook, Charles. "Acknowledgements". cobra-language.com. Cobra Language. Retrieved 7 April 2010.
  116. ^ Esterbrook, Charles. "Comparison to Python". cobra-language.com. Cobra Language. Retrieved 7 April 2010.
  117. ^ "Proposals: iterators and generators [ES4 Wiki]". wiki.ecmascript.org. Retrieved 24 November 2008.
  118. ^ Kincaid, Jason (10 November 2009). "Google's Go: A New Programming Language That's Python Meets C++". TechCrunch. Retrieved 29 January 2010.
  119. ^ Strachan, James (29 August 2003). "Groovy – the birth of a new dynamic language for the Java platform".
  120. ^ Lin, Mike. "The Whitespace Thing for OCaml". Massachusetts Institute of Technology. Retrieved 12 April 2009.
  121. ^ "An Interview with the Creator of Ruby". Linuxdevcenter.com. Retrieved 3 December 2012.
  122. ^ Lattner, Chris (3 June 2014). "Chris Lattner's Homepage". Chris Lattner. Retrieved 3 June 2014. I started work on the Swift Programming Language in July of 2010. I implemented much of the basic language structure, with only a few people knowing of its existence. A few other (amazing) people started contributing in earnest late in 2011, and it became a major focus for the Apple Developer Tools group in July 2013 [...] drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list.
  123. ^ Kupries, Andreas; Fellows, Donal K. (14 September 2000). "TIP #3: TIP Format". tcl.tk. Tcl Developer Xchange. Retrieved 24 November 2008.
  124. ^ Gustafsson, Per; Niskanen, Raimo (29 January 2007). "EEP 1: EEP Purpose and Guidelines". erlang.org. Retrieved 19 April 2011.
  125. ^ "TIOBE Programming Community Index for March 2012". TIOBE Software. March 2012. Retrieved 25 March 2012.

Further reading