| document --- the implementation may change, and other implementations of the |
| same language may work differently. On the other hand, there is currently only |
| one Python implementation in widespread use (although alternate implementations |
| exist), and its particular quirks are sometimes worth being mentioned, |
| especially where the implementation imposes additional limitations. Therefore, |
| you'll find short "implementation notes" sprinkled throughout the text. |
| |
| Every Python implementation comes with a number of built-in and standard |
n | modules. These are not documented here, but in the separate Python Library |
n | modules. These are documented in :ref:`library-index`. A few built-in modules |
| Reference (XXX reference: ../lib/lib.html) document. A few built-in modules are |
| mentioned when they interact in a significant way with the language definition. |
| are mentioned when they interact in a significant way with the language |
| definition. |
| |
| |
| .. _implementations: |
| |
| Alternate Implementations |
| ========================= |
| |
| Though there is one Python implementation which is by far the most popular, |
| Jython |
| Python implemented in Java. This implementation can be used as a scripting |
| language for Java applications, or can be used to create applications using the |
| Java class libraries. It is also often used to create tests for Java libraries. |
| More information can be found at `the Jython website <http://www.jython.org/>`_. |
| |
| Python for .NET |
| This implementation actually uses the CPython implementation, but is a managed |
n | .NET application and makes .NET libraries available. This was created by Brian |
n | .NET application and makes .NET libraries available. It was created by Brian |
| Lloyd. For more information, see the `Python for .NET home page |
n | <http://www.zope.org/Members/Brian/PythonNet>`_. |
n | <http://pythonnet.sourceforge.net>`_. |
| |
| IronPython |
| An alternate Python for .NET. Unlike Python.NET, this is a complete Python |
| implementation that generates IL, and compiles Python code directly to .NET |
| assemblies. It was created by Jim Hugunin, the original creator of Jython. For |
n | more information, see `the IronPython website |
n | more information, see `the IronPython website <http://www.ironpython.com/>`_. |
| <http://workspaces.gotdotnet.com/ironpython>`_. |
| |
| PyPy |
| An implementation of Python written in Python; even the bytecode interpreter is |
| written in Python. This is executed using CPython as the underlying |
| interpreter. One of the goals of the project is to encourage experimentation |
| with the language itself by making it easier to modify the interpreter (since it |
| is written in Python). Additional information is available on `the PyPy |
| project's home page <http://codespeak.net/pypy/>`_. |
| single: BNF |
| single: grammar |
| single: syntax |
| single: notation |
| |
| The descriptions of lexical analysis and syntax use a modified BNF grammar |
| notation. This uses the following style of definition: |
| |
t | .. productionlist:: |
t | .. productionlist:: * |
| name: `lc_letter` (`lc_letter` \| "_")\* |
| name: `lc_letter` (`lc_letter` | "_")* |
| lc_letter: "a"..."z" |
| |
| The first line says that a ``name`` is an ``lc_letter`` followed by a sequence |
| of zero or more ``lc_letter``\ s and underscores. An ``lc_letter`` in turn is |
| any of the single characters ``'a'`` through ``'z'``. (This rule is actually |
| adhered to for the names defined in lexical and grammar rules in this document.) |
| |
| Each rule begins with a name (which is the name defined by the rule) and |