1.1 --- a/lib/__builtins__/str.py Mon Dec 12 22:30:09 2016 +0100
1.2 +++ b/lib/__builtins__/str.py Mon Dec 12 22:33:15 2016 +0100
1.3 @@ -19,7 +19,7 @@
1.4 this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 -from __builtins__.int import maxint, minint
1.8 +from __builtins__.int import maxint
1.9 from __builtins__.operator import _negate
1.10 from __builtins__.sequence import itemaccess
1.11 from __builtins__.types import check_int
1.12 @@ -33,21 +33,30 @@
1.13 _p = maxint / 32
1.14 _a = 31
1.15
1.16 - def __init__(self):
1.17 + def __init__(self, other=None):
1.18
1.19 - "Initialise the string."
1.20 + "Initialise the string, perhaps from 'other'."
1.21
1.22 # Note the __data__ member. Since strings are either initialised from
1.23 # literals or converted using routines defined for other types, no form
1.24 # of actual initialisation is performed here.
1.25
1.26 - self.__data__ = None
1.27 + # NOTE: Cannot perform "other and other.__data__ or None" since the
1.28 + # NOTE: __data__ attribute is not a normal attribute.
1.29 +
1.30 + if other:
1.31 + self.__data__ = other.__data__
1.32 + else:
1.33 + self.__data__ = None
1.34
1.35 # Note the __key__ member. This is also initialised statically. Where
1.36 # a string is the same as an attribute name, the __key__ member contains
1.37 # attribute position and code details.
1.38
1.39 - self.__key__ = None
1.40 + if other:
1.41 + self.__key__ = other.__key__
1.42 + else:
1.43 + self.__key__ = None
1.44
1.45 def __hash__(self):
1.46
1.47 @@ -212,10 +221,10 @@
1.48 return str_substr(self.__data__, start, end, step)
1.49
1.50 class string(basestring):
1.51 - pass
1.52
1.53 -class unicode(basestring):
1.54 - def encode(self, encoding): pass
1.55 + "A plain string of bytes."
1.56 +
1.57 + pass
1.58
1.59 def str(obj):
1.60