Co je to Python, z čeho se skládá?

Příklad jednoduché funkce napsané v Pythonu, která ivertuje tabulku (reprezentovanou jako Python seznam = asociativní pole):

def invert(table):
    index = {}                           # empty dictionary
    for key in table.keys():
        value = table[key]
        if not index.has_key(value):
            index[value] = []            # empty list
        index[value].append(key)
    return index

Příklad interaktivního použití funkce (">>>" je prompt interpretu):

>>> phonebook = {'guido': 4127, 'sjoerd': 4127, 'jack': 4098}
>>> phonebook['dcab'] = 4147             # add an entry
>>> inverted_phonebook = invert(phonebook)
>>> print inverted_phonebook
{4098: ['jack'], 4127: ['guido', 'sjoerd'], 4147: ['dcab']}
>>> 

Python umožňuje psát rozsáhlé projekty, přestože postrádá mnoho compile time kontrol, protože program může být rozdělen do mnoha modulů, každý má vlastní name space a může definovat třídy, které poskytují další zapouzdření. Vyjímky umožňují odchytávat chyby kde je potřeba bez přecpávání kódu chybovými kontrolami.

Trochu historie:

1989 Guido Van Rossum (Amoeba - distribuovaný OS), ABC, Modula 2+, Modula 3
1990, 1991 CWI in Amsterdam (The National Research Institute for Mathematics and Computer Science in the Netherlands).
CNRI (Center for National Research Initiatives) in Reston.
1994 první Workshop
October 1997: 6th International Python Conference
Dec 31 1997: Python 1.5


Srovnání s jinými programovacími jazyky


Standardní knihovny, projekty

Standardní knihovny

Projekty


Python jako univerzální objektové API

CORBA, DCOM, ILU

  1. Klient - prezentace dat, realizace GUI, případně může být schopen i zpracovávat objekty
  2. Transport - HTTP server (může být se SSL)
  3. Object publisher (2. - 3. mohou být nahrazeny DOO technologií)
  4. Aplikační server (vlastní aplikace)
  5. Object midleware (převod objektů do struktury relačních tabulek)
  6. Univerzální DB-API
  7. DB Engine

Současnost, budoucnost


Zdroje

Web

Konference, listy

Články


Python v komerčním prostředí

http://www.python.org/psa/Commercial.html NASA decided to standardize on Python as it's scripting language of choice for the Integrated Planning System
(eShop) Python in a Commercial Environment


Python Copyright

Most Python sources and binaries are distributed under the following copyright. A few files have a different copyright owner, but otherwise the notice is similar.

The gist of it is that Python is absolutely free, even for commercial use (including resale). There is no GNU-like "copyleft" restriction.

A clarification: some very picky lawyers are worried that the notice doesn't explicitly grant permission to distribute modified copies (even though it grants permission to copy, modify, and distribute). This can be considered an oversight in the notice; we have no intention to limit distribution of modified copies (that otherwise play by the rules). We are in the process of revising the notice, but this is a slow process.

Another clarification: the limitation of the copyright to 1991-1995 is not a mistake, but rather a deliberate decision. Copyright applies regardless.

 

Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, The Netherlands.

All Rights Reserved

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Stichting Mathematisch Centrum or CWI or Corporation for National Research Initiatives or CNRI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission.

While CWI is the initial source for this software, a modified version is made available by the Corporation for National Research Initiatives (CNRI) at the Internet address ftp://ftp.python.org.

STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.