Additional clarifications in the WSGI section

This commit is contained in:
Nick Coghlan 2012-03-05 23:12:42 +10:00
parent efff9e9745
commit 80357b7f9a
1 changed files with 6 additions and 4 deletions

View File

@ -245,13 +245,15 @@ the web frameworks and support libraries (both in Python 2 *and* in Python 3).
In practice, native strings are a useful concept because there are some APIs
(both in the standard library and in third party frameworks and packages) and
some internal interpreter details that are designed primarily to work with
native strings. These components often don't support ``unicode`` in Python 2
``str``. These components often don't support ``unicode`` in Python 2
or ``bytes`` in Python 3, or, if they do, require additional encoding details
and/or impose constraints that don't apply to the native string variants.
and/or impose constraints that don't apply to the ``str`` variants.
Some example of interfaces that are best handled as native strings are:
Some example of interfaces that are best handled by using actual ``str``
instances are:
* Python identifiers (dict keys, class names, module names, import paths)
* Python identifiers (as attributes, dict keys, class names, module names,
import references, etc)
* URLs for the most part as well as HTTP headers in urllib/http servers
* WSGI environment keys and CGI-inherited values
* Python source code for dynamic compilation and AST hacks