mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
merge with 3.5
This commit is contained in:
commit
3902d62c4e
69 changed files with 252 additions and 262 deletions
|
@ -545,7 +545,7 @@ learn more about submitting patches to Python.
|
|||
a lengthy tutorial for C programmers.
|
||||
* `The ncurses man page <http://linux.die.net/man/3/ncurses>`_
|
||||
* `The ncurses FAQ <http://invisible-island.net/ncurses/ncurses.faq.html>`_
|
||||
* `"Use curses... don't swear" <http://www.youtube.com/watch?v=eN1eZtjLEnU>`_:
|
||||
* `"Use curses... don't swear" <https://www.youtube.com/watch?v=eN1eZtjLEnU>`_:
|
||||
video of a PyCon 2013 talk on controlling terminals using curses or Urwid.
|
||||
* `"Console Applications with Urwid" <http://www.pyvideo.org/video/1568/console-applications-with-urwid>`_:
|
||||
video of a PyCon CA 2012 talk demonstrating some applications written using
|
||||
|
|
|
@ -332,7 +332,7 @@ substring.
|
|||
|
||||
List comprehensions and generator expressions (short form: "listcomps" and
|
||||
"genexps") are a concise notation for such operations, borrowed from the
|
||||
functional programming language Haskell (http://www.haskell.org/). You can strip
|
||||
functional programming language Haskell (https://www.haskell.org/). You can strip
|
||||
all the whitespace from a stream of strings with the following code::
|
||||
|
||||
line_list = [' line 1\n', 'line 2 \n', ...]
|
||||
|
@ -716,7 +716,7 @@ returns them in a tuple::
|
|||
It doesn't construct an in-memory list and exhaust all the input iterators
|
||||
before returning; instead tuples are constructed and returned only if they're
|
||||
requested. (The technical term for this behaviour is `lazy evaluation
|
||||
<http://en.wikipedia.org/wiki/Lazy_evaluation>`__.)
|
||||
<https://en.wikipedia.org/wiki/Lazy_evaluation>`__.)
|
||||
|
||||
This iterator is intended to be used with iterables that are all of the same
|
||||
length. If the iterables are of different lengths, the resulting stream will be
|
||||
|
@ -1199,7 +1199,7 @@ General
|
|||
|
||||
**Structure and Interpretation of Computer Programs**, by Harold Abelson and
|
||||
Gerald Jay Sussman with Julie Sussman. Full text at
|
||||
http://mitpress.mit.edu/sicp/. In this classic textbook of computer science,
|
||||
https://mitpress.mit.edu/sicp/. In this classic textbook of computer science,
|
||||
chapters 2 and 3 discuss the use of sequences and streams to organize the data
|
||||
flow inside a program. The book uses Scheme for its examples, but many of the
|
||||
design approaches described in these chapters are applicable to functional-style
|
||||
|
@ -1208,12 +1208,12 @@ Python code.
|
|||
http://www.defmacro.org/ramblings/fp.html: A general introduction to functional
|
||||
programming that uses Java examples and has a lengthy historical introduction.
|
||||
|
||||
http://en.wikipedia.org/wiki/Functional_programming: General Wikipedia entry
|
||||
https://en.wikipedia.org/wiki/Functional_programming: General Wikipedia entry
|
||||
describing functional programming.
|
||||
|
||||
http://en.wikipedia.org/wiki/Coroutine: Entry for coroutines.
|
||||
https://en.wikipedia.org/wiki/Coroutine: Entry for coroutines.
|
||||
|
||||
http://en.wikipedia.org/wiki/Currying: Entry for the concept of currying.
|
||||
https://en.wikipedia.org/wiki/Currying: Entry for the concept of currying.
|
||||
|
||||
Python-specific
|
||||
---------------
|
||||
|
|
|
@ -1316,7 +1316,7 @@ An example dictionary-based configuration
|
|||
-----------------------------------------
|
||||
|
||||
Below is an example of a logging configuration dictionary - it's taken from
|
||||
the `documentation on the Django project <https://docs.djangoproject.com/en/1.3/topics/logging/#configuring-logging>`_.
|
||||
the `documentation on the Django project <https://docs.djangoproject.com/en/1.4/topics/logging/#configuring-logging>`_.
|
||||
This dictionary is passed to :func:`~config.dictConfig` to put the configuration into effect::
|
||||
|
||||
LOGGING = {
|
||||
|
|
|
@ -310,7 +310,7 @@ favourite beverage and carry on.
|
|||
If your logging needs are simple, then use the above examples to incorporate
|
||||
logging into your own scripts, and if you run into problems or don't
|
||||
understand something, please post a question on the comp.lang.python Usenet
|
||||
group (available at http://groups.google.com/group/comp.lang.python) and you
|
||||
group (available at https://groups.google.com/group/comp.lang.python) and you
|
||||
should receive help before too long.
|
||||
|
||||
Still here? You can carry on reading the next few sections, which provide a
|
||||
|
|
|
@ -127,7 +127,7 @@ Sort Stability and Complex Sorts
|
|||
================================
|
||||
|
||||
Sorts are guaranteed to be `stable
|
||||
<http://en.wikipedia.org/wiki/Sorting_algorithm#Stability>`_\. That means that
|
||||
<https://en.wikipedia.org/wiki/Sorting_algorithm#Stability>`_\. That means that
|
||||
when multiple records have the same key, their original order is preserved.
|
||||
|
||||
>>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]
|
||||
|
@ -145,7 +145,7 @@ ascending *age*, do the *age* sort first and then sort again using *grade*:
|
|||
>>> sorted(s, key=attrgetter('grade'), reverse=True) # now sort on primary key, descending
|
||||
[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]
|
||||
|
||||
The `Timsort <http://en.wikipedia.org/wiki/Timsort>`_ algorithm used in Python
|
||||
The `Timsort <https://en.wikipedia.org/wiki/Timsort>`_ algorithm used in Python
|
||||
does multiple sorts efficiently because it can take advantage of any ordering
|
||||
already present in a dataset.
|
||||
|
||||
|
@ -184,7 +184,7 @@ decorated list, but including it gives two benefits:
|
|||
directly.
|
||||
|
||||
Another name for this idiom is
|
||||
`Schwartzian transform <http://en.wikipedia.org/wiki/Schwartzian_transform>`_\,
|
||||
`Schwartzian transform <https://en.wikipedia.org/wiki/Schwartzian_transform>`_\,
|
||||
after Randal L. Schwartz, who popularized it among Perl programmers.
|
||||
|
||||
Now that Python sorting provides key-functions, this technique is not often needed.
|
||||
|
|
|
@ -73,7 +73,7 @@ revision of Unicode.
|
|||
precise historical details aren't necessary for understanding how to
|
||||
use Unicode effectively, but if you're curious, consult the Unicode
|
||||
consortium site listed in the References or
|
||||
the `Wikipedia entry for Unicode <http://en.wikipedia.org/wiki/Unicode#History>`_
|
||||
the `Wikipedia entry for Unicode <https://en.wikipedia.org/wiki/Unicode#History>`_
|
||||
for more information.)
|
||||
|
||||
|
||||
|
@ -223,8 +223,8 @@ If this introduction didn't make things clear to you, you should try
|
|||
reading this alternate article before continuing.
|
||||
|
||||
Wikipedia entries are often helpful; see the entries for "`character encoding
|
||||
<http://en.wikipedia.org/wiki/Character_encoding>`_" and `UTF-8
|
||||
<http://en.wikipedia.org/wiki/UTF-8>`_, for example.
|
||||
<https://en.wikipedia.org/wiki/Character_encoding>`_" and `UTF-8
|
||||
<https://en.wikipedia.org/wiki/UTF-8>`_, for example.
|
||||
|
||||
|
||||
Python's Unicode Support
|
||||
|
|
|
@ -267,7 +267,7 @@ Setting up FastCGI
|
|||
Each web server requires a specific module.
|
||||
|
||||
* Apache has both `mod_fastcgi <http://www.fastcgi.com/drupal/>`_ and `mod_fcgid
|
||||
<http://httpd.apache.org/mod_fcgid/>`_. ``mod_fastcgi`` is the original one, but it
|
||||
<https://httpd.apache.org/mod_fcgid/>`_. ``mod_fastcgi`` is the original one, but it
|
||||
has some licensing issues, which is why it is sometimes considered non-free.
|
||||
``mod_fcgid`` is a smaller, compatible alternative. One of these modules needs
|
||||
to be loaded by Apache.
|
||||
|
@ -277,7 +277,7 @@ Each web server requires a specific module.
|
|||
`SCGI module <http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModSCGI>`_.
|
||||
|
||||
* `nginx <http://nginx.org/>`_ also supports `FastCGI
|
||||
<http://wiki.nginx.org/NginxSimplePythonFCGI>`_.
|
||||
<https://www.nginx.com/resources/wiki/start/topics/examples/simplepythonfcgi/>`_.
|
||||
|
||||
Once you have installed and configured the module, you can test it with the
|
||||
following WSGI-application::
|
||||
|
@ -307,8 +307,8 @@ FastCGI access.
|
|||
|
||||
.. seealso::
|
||||
|
||||
There is some documentation on `setting up Django with FastCGI
|
||||
<https://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/>`_, most of
|
||||
There is some documentation on `setting up Django with WSGI
|
||||
<https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/>`_, most of
|
||||
which can be reused for other WSGI-compliant frameworks and libraries.
|
||||
Only the ``manage.py`` part has to be changed, the example used here can be
|
||||
used instead. Django does more or less the exact same thing.
|
||||
|
@ -358,7 +358,7 @@ testing.
|
|||
|
||||
A really great WSGI feature is middleware. Middleware is a layer around your
|
||||
program which can add various functionality to it. There is quite a bit of
|
||||
`middleware <http://www.wsgi.org/en/latest/libraries.html>`_ already
|
||||
`middleware <https://wsgi.readthedocs.org/en/latest/libraries.html>`_ already
|
||||
available. For example, instead of writing your own session management (HTTP
|
||||
is a stateless protocol, so to associate multiple HTTP requests with a single
|
||||
user your application must create and manage such state via a session), you can
|
||||
|
@ -379,7 +379,7 @@ WSGI Servers
|
|||
The code that is used to connect to various low level gateways like CGI or
|
||||
mod_python is called a *WSGI server*. One of these servers is ``flup``, which
|
||||
supports FastCGI and SCGI, as well as `AJP
|
||||
<http://en.wikipedia.org/wiki/Apache_JServ_Protocol>`_. Some of these servers
|
||||
<https://en.wikipedia.org/wiki/Apache_JServ_Protocol>`_. Some of these servers
|
||||
are written in Python, as ``flup`` is, but there also exist others which are
|
||||
written in C and can be used as drop-in replacements.
|
||||
|
||||
|
@ -390,8 +390,8 @@ compared with other web technologies.
|
|||
.. seealso::
|
||||
|
||||
A good overview of WSGI-related code can be found in the `WSGI homepage
|
||||
<http://www.wsgi.org/en/latest/index.html>`_, which contains an extensive list of `WSGI servers
|
||||
<http://www.wsgi.org/en/latest/servers.html>`_ which can be used by *any* application
|
||||
<https://wsgi.readthedocs.org/>`_, which contains an extensive list of `WSGI servers
|
||||
<https://wsgi.readthedocs.org/en/latest/servers.html>`_ which can be used by *any* application
|
||||
supporting WSGI.
|
||||
|
||||
You might be interested in some WSGI-supporting modules already contained in
|
||||
|
@ -408,7 +408,7 @@ an application that's been around for a while, which was written in
|
|||
Python without using WSGI.
|
||||
|
||||
One of the most widely used wiki software packages is `MoinMoin
|
||||
<http://moinmo.in/>`_. It was created in 2000, so it predates WSGI by about
|
||||
<https://moinmo.in/>`_. It was created in 2000, so it predates WSGI by about
|
||||
three years. Older versions needed separate code to run on CGI, mod_python,
|
||||
FastCGI and standalone.
|
||||
|
||||
|
@ -460,7 +460,7 @@ maintainable web sites.
|
|||
.. seealso::
|
||||
|
||||
The English Wikipedia has an article about the `Model-View-Controller pattern
|
||||
<http://en.wikipedia.org/wiki/Model-view-controller>`_. It includes a long
|
||||
<https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller>`_. It includes a long
|
||||
list of web frameworks for various programming languages.
|
||||
|
||||
|
||||
|
@ -543,10 +543,10 @@ module, and which uses only one file. It has no other dependencies. For
|
|||
smaller sites SQLite is just enough.
|
||||
|
||||
Relational databases are *queried* using a language called `SQL
|
||||
<http://en.wikipedia.org/wiki/SQL>`_. Python programmers in general do not
|
||||
<https://en.wikipedia.org/wiki/SQL>`_. Python programmers in general do not
|
||||
like SQL too much, as they prefer to work with objects. It is possible to save
|
||||
Python objects into a database using a technology called `ORM
|
||||
<http://en.wikipedia.org/wiki/Object-relational_mapping>`_ (Object Relational
|
||||
<https://en.wikipedia.org/wiki/Object-relational_mapping>`_ (Object Relational
|
||||
Mapping). ORM translates all object-oriented access into SQL code under the
|
||||
hood, so the developer does not need to think about it. Most `frameworks`_ use
|
||||
ORMs, and it works quite well.
|
||||
|
@ -579,13 +579,13 @@ alternate storage mechanism.
|
|||
helps with choosing a method for saving data
|
||||
|
||||
* `SQLAlchemy <http://www.sqlalchemy.org/>`_, the most powerful OR-Mapper
|
||||
for Python, and `Elixir <http://elixir.ematia.de/>`_, which makes
|
||||
for Python, and `Elixir <https://pypi.python.org/pypi/Elixir>`_, which makes
|
||||
SQLAlchemy easier to use
|
||||
|
||||
* `SQLObject <http://www.sqlobject.org/>`_, another popular OR-Mapper
|
||||
|
||||
* `ZODB <https://launchpad.net/zodb>`_ and `Durus
|
||||
<http://www.mems-exchange.org/software/durus/>`_, two object oriented
|
||||
<https://www.mems-exchange.org/software/>`_, two object oriented
|
||||
databases
|
||||
|
||||
|
||||
|
@ -671,10 +671,10 @@ experience. TurboGears gives the user flexibility in choosing components. For
|
|||
example the ORM and template engine can be changed to use packages different
|
||||
from those used by default.
|
||||
|
||||
The documentation can be found in the `TurboGears wiki
|
||||
<http://docs.turbogears.org/>`_, where links to screencasts can be found.
|
||||
The documentation can be found in the `TurboGears documentation
|
||||
<https://turbogears.readthedocs.org/>`_, where links to screencasts can be found.
|
||||
TurboGears has also an active user community which can respond to most related
|
||||
questions. There is also a `TurboGears book <http://turbogearsbook.com/>`_
|
||||
questions. There is also a `TurboGears book <http://turbogears.org/1.0/docs/TGBooks.html>`_
|
||||
published, which is a good starting point.
|
||||
|
||||
The newest version of TurboGears, version 2.0, moves even further in direction
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue