text
stringlengths
0
7.07k
Python provides a round function for rounding a float to the nearest integer . For tie @-@ breaking , versions before 3 use round @-@ away @-@ from @-@ zero : round ( 0 @.@ 5 ) is 1 @.@ 0 , round ( -0.5 ) is − 1 @.@ 0 . Python 3 uses round to even : round ( 1 @.@ 5 ) is 2 , round ( 2 @.@ 5 ) is 2 .
Python allows boolean expressions with multiple equality relations in a manner that is consistent with general use 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 fi...
Python has extensive built @-@ in support for arbitrary precision arithmetic . Integers are transparently switched from the machine @-@ supported maximum fixed @-@ precision ( usually 32 or 64 bits ) , belonging to the python type int , to arbitrary precision , belonging to the python type long , where needed . The la...
Due to Python 's extensive mathematics library , it is frequently used as a scientific scripting language to aid in problems such as numerical data processing and manipulation .
= = Libraries = =
Python has a large standard library , commonly cited as one of Python 's greatest strengths , providing tools suited to many tasks . This is deliberate and has been described as a " batteries included " Python philosophy . For Internet @-@ facing applications , many standard formats and protocols ( such as MIME and HT...
Some parts of the standard library are covered by specifications ( for example , the Web Server Gateway Interface ( WSGI ) implementation wsgiref follows PEP 333 ) , but most modules are not . They are specified by their code , internal documentation , and test suite ( if supplied ) . However , because most of the sta...
The standard library is not needed to run Python or embed it in an application . For example , Blender 2 @.@ 49 omits most of the standard library .
As of January 2016 , the Python Package Index , the official repository of third @-@ party software for Python , contains more than 72 @,@ 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 ( read – eval – print loop ( REPL ) ) . In short , Python acts as a command @-@ line interface or shell .
Other shells add abilities 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 , session state retention , and syntax highlighting .
In addition to standard desktop integrated development environments ( Python IDEs ) , there are also web 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 . It compiles Python programs into intermediate bytecode , which is executed by the virtual machine . CPython is distributed with a large standard library written in a mixture of C and Python . It is available in versions for man...
PyPy is a fast , compliant interpreter of Python 2 @.@ 7 and 3 @.@ 2 . Its just @-@ in @-@ time compiler brings a significant speed improvement over CPython . A version taking advantage of multi @-@ core processors using software transactional memory is being created .
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 .
MicroPython is a lean , fast Python 3 variant that is optimised to run on microcontrollers .
Other just @-@ in @-@ time compilers have been developed in the past , but are now unsupported :
Google began a project named Unladen Swallow in 2009 with the aims of speeding up the Python interpreter by 5 times , by using the LLVM , and of improving its multithreading ability to scale to thousands of cores .
Psyco is a just @-@ in @-@ time specialising compiler that integrates with CPython and transforms bytecode to machine code at runtime . The emitted 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 named PyS60 . It includes many of the modules from the CPython implementations and some added modules to integrate with the Symbian operating system . This project has been kept up to date to run on all variants of the S60 platform and there...
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 :
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 .
IronPython follows a similar approach in order to run Python programs on the .NET Common Language Runtime .
The RPython language can be compiled to C , Java bytecode , or Common Intermediate Language , and is used to build the PyPy interpreter of Python .
Pyjamas compiles Python to JavaScript .
Shed Skin compiles Python to C + + .
Cython and Pyrex compile to C.
A performance comparison of various Python implementations on a non @-@ numerical ( combinatorial ) workload was presented at EuroSciPy ' 13 .
= = 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 . Outstanding PEPs are review...
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. Development takes place on a self ...
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 .
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...
Many alpha , beta , and release @-@ candidates are also released as previews , and for testing before final releases . Although there is a rough schedule for each release , this is often pushed back if the code is not ready . The development team monitors the state of the code by running the large unit test suite duri...
The community of Python developers has also contributed over 72 @,@ 000 software modules ( as of January 2016 ) to the Python Package Index ( 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 , and it is common to use Monty Python references in example code . For example , the metasyntactic variables often used in Python literature are spam and eggs , instead of the traditional foo and bar . Also , the official Python docume...
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 bi...
= = Uses = =
Since 2003 , Python has consistently ranked in the top ten most popular programming languages as measured by the TIOBE Programming Community Index . As of June 2016 , it is the fourth most popular language . It was ranked as Programming Language of the Year for the year 2007 and 2010 . It is the third most popular lan...
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 + + " .
Large organizations that make use of Python include Google , Yahoo ! , CERN , NASA , and some smaller ones like ILM , and ITA . The social news networking site , Reddit , is written entirely in Python .
Python can serve as a scripting language for web applications , e.g. , via mod _ wsgi for the Apache web server . With Web Server Gateway Interface , a standard API has evolved to facilitate these applications . Web frameworks like Django , Pylons , Pyramid , TurboGears , web2py , Tornado , Flask , Bottle and Zope sup...
Libraries like NumPy , SciPy and Matplotlib allow the effective use of Python in scientific computing , 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 ...
Python has been successfully embedded in many 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 v...
Python has been used in artificial intelligence tasks . As a scripting language with module architecture , simple syntax and rich text processing tools , Python is often used for natural language processing tasks .
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 . Many Linux distributions use installers written in Python : Ubuntu uses the Ubiquity installer , while Red Hat Linux a...
Python has also seen extensive use in the information security industry , including in exploit development .
Most of the Sugar software for the One Laptop per Child XO , now developed at Sugar Labs , is written in Python .
The Raspberry Pi single @-@ board computer project has adopted Python as its main user @-@ programming language .
LibreOffice includes Python and intends to replace Java with Python . Python Scripting Provider is a core feature since Version 4 @.@ 0 from 7 February 2013 .
= = Languages influenced by Python = =
Python 's design and philosophy have influenced several programming languages , including :
Boo uses indentation , a similar syntax , and a similar object model . However , Boo uses static typing ( and optional duck typing ) and is closely integrated with the .NET Framework .
Cobra uses indentation and a similar syntax . Cobra 's " Acknowledgements " document lists Python first among languages that influenced it . However , Cobra directly supports design @-@ by @-@ contract , unit tests , and optional static typing .
ECMAScript borrowed iterators , generators , and list comprehensions from Python .
Go is described as incorporating the " development speed of working in a dynamic language like Python " .
Groovy was motivated by the desire to bring the Python design philosophy to Java .
Julia was designed " with true macros [ .. and to be ] as usable for general programming as Python [ and ] should be as fast as C " . Calling to or from Julia is possible ; to with PyCall.jl and a Python package pyjulia allows calling , in the other direction , from Python .
OCaml has an optional syntax , named twt ( The Whitespace Thing ) , inspired by Python and Haskell .
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 . "
CoffeeScript is a programming language that cross @-@ compiles to JavaScript ; it has Python @-@ inspired syntax .
Swift is a programming language invented by Apple ; it has some Python @-@ inspired syntax .
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 and Erlang 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 .
= Lisa the Vegetarian =
" Lisa the Vegetarian " is the fifth episode of the seventh season of the American television series The Simpsons . It originally aired on the Fox network in the United States on October 15 , 1995 . In the episode , Lisa decides to stop eating meat after bonding with a lamb at a petting zoo . Her schoolmates and famil...
Directed by Mark Kirkland , " Lisa the Vegetarian " is the first full @-@ length episode David S. Cohen wrote for The Simpsons . David Mirkin , the show runner at the time , supported the episode in part because he had just become a vegetarian himself . Former Beatle Paul McCartney and his then wife Linda McCartney gu...
The inaugural airing of " Lisa the Vegetarian " was watched by 14 @.@ 6 million viewers and finished 47th in the ratings for the week of October 9 – 15 , 1995 , with a 9 @.@ 0 Nielsen rating . It was the fourth highest @-@ rated show on the Fox network that week . The episode received generally positive reviews from t...
= = Plot = =
The Simpson family visit Story Town Village , an amusement park for babies , as a special treat for Maggie . In the village , there is a petting zoo , where Lisa is enamored by a cute lamb . That night , Marge serves lamb chops for dinner , but Lisa is troubled by the connection between the dish and its living counter...
Homer and Bart continue to give Lisa a hard time at home , particularly since Homer is preparing to host a barbecue , complete with roast pig . Bart and Homer even form a conga line and sing , " You don 't win friends with salad ! " On the day of the barbecue , Lisa makes gazpacho for all the guests as an alternative ...
At home , Homer reprimands Lisa for ruining his party and demands an apology , but Lisa refuses to apologize and chews him out for serving a meat @-@ based dish . They fight and she leaves the house , not wanting to live in a house with a " prehistoric carnivore . " As Lisa walks along , she decides that she can no lo...