版本5和11间的区别 (跳过第6版)
于2006-06-16 21:07:38修订的的版本5
大小: 16445
编辑: czk
备注:
于2006-06-21 21:04:52修订的的版本11
大小: 1182
编辑: czk
备注:
删除的内容标记成这样。 加入的内容标记成这样。
行号 5: 行号 5:
== 总览 == Python是一种解释型的编程语言,由Guido van Rossum于1990年创造。Python是完全动态类型的语言,使用自动的内存管理;在这方面它和Perl、Ruby、Scheme、Smalltalk和Tcl语言是类似的。Python是由开放源代码项目开发,由非盈利性组织Python软件基金会(Python Software Foundation)管理,并在项目网站上免费开放。Python 2.4.3版于2006年3月29日发布。
行号 7: 行号 7:
Python开发人员一直在讨论Python的未来版本Python 3.0(这个项目被称作"Python 3000"或"Py3K")。它将会打破对2.x系列的向后兼容性,来修正语言中存在的一些已知的缺陷。指导原则是"通过去除老的解决问题的方法,来减少重复的语言特性"。现在还没有Python 3.0的确定的时间表,但是一个PEP(Python Enhancement Proposal)中详细描述了计划要改变的东西。 ||编程范式:||多范式||
||出现时间:||1990||
||设计者:||Guido van Rossum||
||开发者:||Python Software Foundation||
||最新版本:||2.4.3 / March 29, 2006||
||类型规则:||强类型,动态类型(鸭子类型)||
||主要的实现版本:||CPython, Jython, IronPython, PyPy||
||受哪些语言影响:||ABC, Modula-3, Icon, C, Perl, Lisp, Smalltalk, Tcl||
||影响了哪些语言:||Ruby, Boo||
||操作系统:||跨平台||
||许可证:||Python Software Foundation License||
||网站:||www.python.org||
行号 9: 行号 20:
计划要改变的东西包括:

    * move map, filter and reduce out of the built-in namespace (the rationale being that map and filter are expressed more clearly as list comprehensions, and reduce more clearly as an accumulation loop)
    * add support for optional type declarations
    * unify the str/unicode types, and introduce a separate mutable bytes type
    * convert built-ins to returning iterators (instead of lists), where appropriate
    * remove backwards-compatibily features like classic classes, classic division, string exceptions, implicit relative imports

== Python语法特点 ==

Python被设计成具有高度可读性的语言。它努力使代码看上去布局整齐,更多的使用英语单词来代替其他语言中的标点符号,并且它的语法结构比其他结构化语言(比如C、Perl或者Pascal)少得多。

=== Indentation 缩进 ===

Python使用缩进而不是一对花括号来划分语句块。对某些特定语句后面的语句增加缩进量(来表示语句块的开始);用减少缩进量来表示当前语句块的结束。

=== 语句 ===

Python的语句包括:

    * if语句和else、elif(else-if的缩写)一起使用,实现按一定的条件去执行语句块。
    * while语句反复执行一个语句块,直到条件变成False
    * for循环语句跌代一个可跌代的东西,取出其中每一个元素赋给一个局部变量,这个变量在该语句附属的语句块中可以使用。
    * class statements execute a block of code and attach its local namespace to a class, for use in object oriented programming. class语句执行一个语句块,并把一个局部名字空间和一个类绑定在一起。它用在面向对象编程上。
    * def语句定义一个函数

每个语句都有它自己的语义:比如说,def语句和其他很多语句不同,它不会马上执行它附属的语句块,

=== 基本数据类型 ===

Python包括一组不同的数据类型。其中最常用的是:

    * list — 一种可变的顺序容器。
    * str — 一种不可变的由字符构成的顺序容器(字符串)。
    * dict — 一种字典
    * set — 和数学上的集合差不多的东西(无序的容器,其中每个元素只出现一次)。

这里并没有列出全部类型,Python中还有很多其他类型。而以上这些是最常用的部分。

== Python支持的平台 ==

运行Python最流行的平台(因此也是维护得最好的平台)是Linux、BSD、Mac OS X和Microsoft Windows。此外,在Java平台上和.Net Framework(或者Mono)上也有一些独立开发的Python的实现,分别称作Jython和IronPython。其他支持的平台包括:

类Unix系统

    * AIX operating system
    * BSD
    * FreeBSD
    * NetBSD
    * Linux
    * OpenBSD
    * SPARC Solaris
    * Other Unixes, e.g. Irix

 

桌面操作系统

    * Amiga
    * AROS
    * BeOS
    * Mac OS 9
    * Mac OS X
    * Microsoft Windows
    * OS/2
    * RISC OS (formerly Acorn)

特殊的和嵌入式的系统

    * GP2X
    * Java virtual machine
    * Nokia 770 Internet Tablet
    * Palm OS
    * PlayStation 2
    * PlayStation Portable
    * Psion
    * QNX
    * Sharp Zaurus
    * Symbian OS
    * Windows CE/Pocket PC
    * Xbox (Used in XBMC)
    * VxWorks

大型机和其他系统

    * AS/400
    * OS/390
    * Plan 9 from Bell Labs
    * VMS
    * z/OS

Python的大部分第三方库(甚至部分官方库)只支持Windows、Linux、BSD和Mac OS X。

Python最早是作为Amoeba操作系统上一种能够进行系统调用的脚本语言开发的;然而那个版本现在不再维护了。

== Python应用领域 ==

Python is used in a wide variety of application domains, including web and internet, database, desktop GUIs, scientific and numeric computation, education, network programming, software build and testing, and game development and 3D rendering, among others.

=== 网页与因特网开发 ===

Python offers a wide range of choices for web development including high-end solutions such as Zope, mega frameworks such as Django and TurboGears, and advanced content management systems such as Plone and CPS. Python is also great for CGI.

Python's extensive support for XML, email, RSS feeds, and many other Internet protocols makes Python a great choice for developing custom web solutions and other internet-based applications.
=== 数据库访问 ===

Need to access a database? Custom and ODBC interfaces to MySQL, Oracle, MS SQL Server, PostgreSQL, SybODBC, and others are available for free download.

=== 桌面图形界面 ===

Python arrives on your hard drive with the Tk GUI development library. Third-party libraries are available for MFC (via win32 extensions), wxWidgets, GTK, Qt, Delphi, and more.
Scientific and Numeric

Python is widely used in scientific and numeric computing, including in Bioinformatics (see also Python course in Bioinformatics) and Physics, among others.
=== 教育 ===

Python is a superb language for teaching programming, both at the introductory level and for more advanced courses. The Education Special Interest Group is a good place to start. See also pyBiblio and the Software Carpentry Course (funded by the Python Software Foundation).
=== 网络编程 ===

In addition to web and internet support described above, Python also provides support for lower level network programming with its easy to use sockets implementation and with powerful third party modules such as Twisted, a framework for asyncronous network programming,
=== 软件开发 ===

Python is often used as a support language for software developers, for build control and management, testing, and in many other ways. Some of the development support tools written in Python include SCons for build control, Buildbot and Apache Gump for automated continuous compilation and testing, and Trac for bug tracking and project management.

See also the list of Integrated Development Environments available for Python and the Python Package Index, which hosts thousands of third party modules for Python.
=== 游戏和三维图形 ===

Python is widely used in commercial and hobby game development (some of which are listed on the Python Games wiki page). PyGame and PyKyra are two of the game frameworks available for Python. There are also a number of 3D rendering libraries available for Python.


== Python应用实例 ==

The Python programming language is actively used in industry and academia for a wide variety of purposes.

=== Python的教育用途 ===

As of 2005, Python is getting more popular for teaching computer programming. Its strengths for teaching include its syntactic simplicity, flexible typing, and interactive interpreter.

Python uses far fewer symbols than languages like Java and C. For example blocks inside loops and IF statements are indicated by indentation rather than curly braces ({}), and the end of a line does not have to have a semicolon. Beginning students often have initial trouble with memorizing where curly braces and semi-colons go. With Python students can skip directly to the fun part of writing code that does something. Similarly, with Java, and C++, variables types must be declared before being used. That is not needed in Python which again allows students to quickly get to the interesting part of getting their program to do something.

The interactive interpreter is an extremely valuable aid to learning and experimentation. Learning-by-doing is about trying things out and seeing what happens. The faster you can get results from your experiment, the faster that learning produces results. Experience has shown that the interactive interpreter and lack of a compiler really speeds up the learning process, both for beginners and for pros who are learning a new library and such.

=== 使用Python的大型组织 ===

    * Google uses Python for many tasks including the backends of web apps such as Gmail and Google Maps and for many of its search-engine internals.
    * NASA is using Python to implement a CAD/CAE/PDM repository and model management, integration, and transformation system which will be the core infrastructure for its next generation collaborative engineering environment.

=== 使用Python写成的软件 ===

    * BitTorrent, the original implementation and several derivatives
    * Chandler, a personal information manager including calendar, email, tasks and notes support that is currently under development
    * Civilization IV videogame and the newly released computer game uses boost.python to allow the Python programming language access to many parts of the game (including the style and content of all interface screens)
    * Mailman, one of the more popular packages for running email mailing lists
    * Kombilo, go games' database manager and browser.
    * MoinMoin, a popular wiki engine in Python
    * OpenRPG, a virtual table on which to play Role Playing Games over the internet
    * Plone, a user-friendly and powerful open source Content Management System
    * Portage, the heart of Gentoo Linux. An advanced package management system based on the *BSD style ports system
    * Solipsis, a system for massively shared virtual world
    * Trac, bug/issue tracking database, integrated with MoinMoin wiki and Subversion source version control
    * Turbogears, an application framework composed of Cherrypy, SQLObject, MochiKit, and KID templates
    * Vampire: The Masquerade - Bloodlines, a videogame, uses Python for game scripting
    * ViewVC, a web-based interface for browsing CVS and SVN repositories
    * Zope, an object-oriented web-application platform. Zope includes an application server with an integrated object-oriented database and a built-in web-based management interface
    * Battlefield 2, a first person shooter that uses python for its configuration scripts
    * Indian Ocean Tsunami Detector, a free mobile phone software for tsunami prediction.
    * EVE Online, a space Multi Massive Online Role Playing Game, the highest-ranked MMORPG on MMORPG.com
    * SPE - Stani's Python Editor, a free, open-source Python IDE for Windows, Linux & Mac with wxGlade (GUI designer), PyChecker (Code Doctor) and Blender (3D) support.

=== Python包 ===

The Python Cheese Shop and Vaults of Parnassus are two primary directories of hundreds of Python packages

    * matplotlib, an extension providing matlab-like plotting and mathematical functions
    * Numeric Python, a language extension that adds support for large, multi-dimensional arrays and matrices
    * SciPy, a library of scientific and numerical routines
    * SimPy, a discrete-event simulation package;
    * Biopython, an international association of developers of freely available Python tools for computational molecular biology.
    * PyOpenGL, a package that allows 3D rendering using Python
    * Soya 3D, a high-level 3D game engine for Python
    * Pygame http://www.pygame.org Python game development
    * Python Imaging Library, a module for working with images
    * PyGTK, http://www.pygtk.org/, a popular cross-platform GUI library based on GTK+; furthermore, other GNOME libraries also have bindings for Python
    * PyQt, another popular cross-platform GUI library based on Qt; as above, KDE libraries have bindings too
    * wxPython, a port of wxWidgets and a popular cross-platform GUI library for Python

    * PyObjC, a Python-Objective C bridge that allows one to write Mac OS X software in Python
    * py2exe, compiler that turns Python scripts into standalone Windows programs

    * CherryPy, a Python-powered web framework
    * Django, another Python-powered web framework
    * Topsite Templating System, another Python-powered web framework
    * TurboGears, a web framework combining CherryPy, SQLObject, and Kid
    * ZODB a Python-specific object-oriented database
    * Cheetah, a Python-powered template engine and code-generation tool
    * mod_python, an Apache module allowing direct integration of Python scripts with the Apache web server
    * Quixote (software) a framework for developing Web applications in Python
    * Twisted, a networking framework for Python

See more recommended modules at Useful Modules in the Python.org wiki.

=== Python软件目录 ===

    * Python Cheese Shop (also called the Python Package Index or PyPI) is the official directory of Python software libraries and modules.
    * ActiveState O'Reilly Python Cookbook contains hunderds of code samples for various tasks using Python.
    * Python Projects and Modules lots of useful code, as well as several articles on Python Programming.
    * Vaults of Parnassus — Links to resources.
    * Python 3D Software Collection — pointers to packages specifically useful in the production of 3D software and/or games with Python

== Python的实现 ==

The standard Python interpreter also supports an interactive mode in which it acts as a kind of shell: expressions can be entered one at a time, and the result of their evaluation is seen immediately. This is a boon for those learning the language and experienced developers alike: snippets of code can be tested in interactive mode before integrating them into a proper program. As well, the Python shell is often used to interactively perform system tasks, such as modifying files.

Python also includes a unit testing framework for creating exhaustive test suites. While static typing aficionados see this as a replacement for a static type-checking system, Python programmers largely do not share this view.

Standard Python does not support continuations, and according to Guido van Rossum, never will. However, better support for coroutine-like functionality is planned, by extending Python's generators [3]

    * Python – The reference implementation, also known as CPython
    * Jython – Python coded in Java
    * IronPython – Python for .NET and Mono platforms
    * Boo – Python-based but with static typing, for .NET and Mono
    * Stackless Python - Python with coroutines
    * Psyco - not an implementation, but JIT compiler for CPython
    * PyPy – Python coded in Python
    * Parrot – Virtual machine being developed mainly as the runtime for Perl 6, but with the intent to also support dynamic languages like Python, Ruby, Tcl, etc. Can currently execute a subset of Python
    * Logix – Python alternate front-end with macros
    * Movable Python- An alternative distribution of CPython for Windows. It can run off a USB stick and provides a Portable Programming Environment.

== Python的标准库 ==

Python has a large standard library, which makes it well suited to many tasks. This comes from a so-called "batteries included" philosophy for Python modules. The modules of the standard library can be augmented with custom modules written in either C or Python. The standard library is particularly well tailored to writing Internet-facing applications, with a large number of standard formats and protocols (such as MIME and HTTP) supported. Modules for creating graphical user interfaces, connecting to relational databases, arithmetic with arbitrarily precise decimals, and manipulating regular expressions are also included.

The standard library is one of Python's greatest strengths. The bulk of it is cross-platform compatible, meaning that even heavily leveraged Python programs can often run on Unix, Windows, Macintosh, and other platforms without change.

It is currently being debated whether or not third-party but open source Python modules such as Twisted, NumPy, or wxPython should be included in the standard library, in accordance with the batteries included philosophy.
 * ["/Python设计哲学"]
 * ["/Python历史"]
 * ["/Python语法特点"]
 * ["/Python支持的平台"]
 * ["/Python应用领域"]
 * ["/Python应用实例"]

TableOfContents

Python语言介绍

Python是一种解释型的编程语言,由Guido van Rossum于1990年创造。Python是完全动态类型的语言,使用自动的内存管理;在这方面它和Perl、Ruby、Scheme、Smalltalk和Tcl语言是类似的。Python是由开放源代码项目开发,由非盈利性组织Python软件基金会(Python Software Foundation)管理,并在项目网站上免费开放。Python 2.4.3版于2006年3月29日发布。

编程范式:

多范式

出现时间:

1990

设计者:

Guido van Rossum

开发者:

Python Software Foundation

最新版本:

2.4.3 / March 29, 2006

类型规则:

强类型,动态类型(鸭子类型)

主要的实现版本:

CPython, Jython, IronPython, PyPy

受哪些语言影响:

ABC, Modula-3, Icon, C, Perl, Lisp, Smalltalk, Tcl

影响了哪些语言:

Ruby, Boo

操作系统:

跨平台

许可证:

Python Software Foundation License

网站:

www.python.org

  • ["/Python设计哲学"]
  • ["/Python历史"]
  • ["/Python语法特点"]
  • ["/Python支持的平台"]
  • ["/Python应用领域"]
  • ["/Python应用实例"]

Python介绍 (2020-04-21 14:11:21由czk编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.