← Back
Editing: newstr.cpython-38.pyc
U ,�]�= � @ s� d Z ddlmZ ddlmZmZmZmZ ddlm Z m Z ddlmZ erZe ZddlmZ nddlmZ G dd� de�ZG d d � d eee��Zd gZdS )a This module redefines ``str`` on Python 2.x to be a subclass of the Py2 ``unicode`` type that behaves like the Python 3.x ``str``. The main differences between ``newstr`` and Python 2.x's ``unicode`` type are the stricter type-checking and absence of a `u''` prefix in the representation. It is designed to be used together with the ``unicode_literals`` import as follows: >>> from __future__ import unicode_literals >>> from builtins import str, isinstance On Python 3.x and normally on Python 2.x, these expressions hold >>> str('blah') is 'blah' True >>> isinstance('blah', str) True However, on Python 2.x, with this import: >>> from __future__ import unicode_literals the same expressions are False: >>> str('blah') is 'blah' False >>> isinstance('blah', str) False This module is designed to be imported together with ``unicode_literals`` on Python 2 to bring the meaning of ``str`` back into alignment with unprefixed string literals (i.e. ``unicode`` subclasses). Note that ``str()`` (and ``print()``) would then normally call the ``__unicode__`` method on objects in Python 2. To define string representations of your objects portably across Py3 and Py2, use the :func:`python_2_unicode_compatible` decorator in :mod:`future.utils`. � )�Number)�PY3�istext�with_metaclass� isnewbytes)�no�issubset)� newobject)�Iterablec @ s e Zd Zdd� ZdS )� BaseNewStrc C s"