Skip to content

Commit

Permalink
Use 'text' instead of 'unicode'
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Jun 29, 2017
1 parent 891ada3 commit d1fdc37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions docs/api/adapter.rst
Expand Up @@ -358,7 +358,8 @@ Let's register some adapters first:
>>> gsm.registerAdapter(Comp, [None], I5, 'foo')

Now we get all the adapters that are registered for ``ob`` that provide
``I5`` (note that on Python 2 the names will be ``unicode``):
``I5`` (note that the names are always text strings, meaning that on
Python 2 the names will be ``unicode``):

.. doctest::

Expand All @@ -367,10 +368,10 @@ Now we get all the adapters that are registered for ``ob`` that provide
>>> [(str(name), adapter.__class__.__name__) for name, adapter in adapters]
[('', 'Comp'), ('foo', 'Comp')]
>>> try:
... unicode = unicode
... text = unicode
... except NameError:
... unicode = str # Python 3
>>> [isinstance(name, unicode) for name, _ in adapters]
... text = str # Python 3
>>> [isinstance(name, text) for name, _ in adapters]
[True, True]

Note that the output doesn't include None values. If an adapter
Expand Down
9 changes: 5 additions & 4 deletions docs/socketexample.rst
Expand Up @@ -231,15 +231,16 @@ to know about all the adapters that convert a German to a US socket type:
entry of the tuple is the name of the adapter and the second is the
adapter itself.

Note that the names are ``unicode`` on Python 2:
Note that the names are always text strings, meaning ``unicode`` on
Python 2:

.. doctest::

>>> try:
... unicode = unicode
... text = unicode
... except NameError:
... unicode = str
>>> [isinstance(name, unicode) for name, _ in sockets]
... text = str
>>> [isinstance(name, text) for name, _ in sockets]
[True, True, True]


Expand Down

0 comments on commit d1fdc37

Please sign in to comment.