Академический Документы
Профессиональный Документы
Культура Документы
HISTORY
Python was created in the early 1990s by Guido van Rossum at Stichting Mathematisch Centrum (CWI) in
the Netherlands as a successor of a language called ABC. Guido is Python's principal author, although it
includes many contributions from others. The last version released from CWI was Python 1.2. In 1995,
Guido continued his work on Python at the Corporation for National Research Initiatives (CNRI) in Reston,
Virginia where he released several versions of the software. Python 1.6 was the last of the versions
released by CNRI. In 2000, Guido and the Python core development team moved to BeOpen.com to form
the BeOpen PythonLabs team. Python 2.0 was the first and only release from BeOpen.com.
Following the release of Python 1.6, and after Guido van Rossum left CNRI to work with commercial
software developers, it became clear that the ability to use Python with software available under the GNU
Public License (GPL) was very desirable. CNRI and the Free Software Foundation (FSF) interacted to
develop enabling wording changes to the Python license. Python 1.6.1 is essentially the same as Python
1.6, with a few minor bug fixes, and with a different license that enables later versions to be
GPLcompatible. Python 2.1 is a derivative work of Python 1.6.1, as well as of Python 2.0.
After Python 2.0 was released by BeOpen.com, Guido van Rossum and the other PythonLabs developers
joined Digital Creations. All intellectual property added from this point on, starting with Python 2.1 and
its alpha and beta releases, is owned by the Python Software Foundation (PSF), a nonprofit modeled
after the Apache Software Foundation. See http://www.python.org/psf/ for more information about the
PSF.
PYTHON
Python allows:
dynamic type binding
static scoping and global scoping
nested subprograms
Data types are strongly and dynamically typed. Mixing incompatible types causes an exception
to be raised, so errors are caught sooner.
In Python, any variable can name a value of any type. Variables are not declared to have a type,
as they are in many other languages; they are simply assigned a value.
Consequently, data type names almost never appear in Python programs. However, all values or
objects have types.
The types of operands in expressions are checked at run time, so type errors do not go
undetected; however, the programmer does not have to worry about mentioning data types
when writing code.
You can use some data type names as type conversion functions. For example, when the user
enters a number at the keyboard, the input function returns a string of digits, not a numeric
value. The program must convert this string to an int or a float before numeric processing.
Like most other languages, Python allows operands of different numeric types in arithmetic
expressions. In those cases, the result type is the same as the most general operand type. For
example, the addition of an int and a float produces a float as the result.
PYTHON
DATA TYPES
Primitive data types:
integer numeric values with no fractional part
-9
50
0x4F 077
floating-point numeric values with a fractional part
25.45 -17.4 0.34 17.045E-03
boolean logical values of true or false
True False
string an ordered sequence of alphanumeric characters
string
another string c
list an ordered sequence of objects in which each element is identified by an integer
subscript
[0, 1, 2, 3]
[abc, 1, 4.5]
[]
tuples similar to a list type but the contents of a tuple cannot be changed once it has
been created
(a, b, c)
(1, 4, 5, 8)
dictionary a collection of items in which each items contains a key and a
corresponding value
{123 : bob, 456 : sally}
PYTHON
PYTHON
PYTHON
PYTHON
SYNTAX: SUBPROGRAMS
| '**'
| '**'
| '**'
| '**'
PYTHON
References:
Lambert, K. (2014). Fundamentals of Python: Data structures. Boston, MA: Cengage Learning.
Necaise, R. (2011). Data structures and algorithms using Python. Danvers, MA: John Wiley & Sons.
https://docs.python.org/3/index.html
https://docs.python.org/3/reference/grammar.html