1.1 --- a/lib/__builtins__/unicode.py Thu Dec 15 01:39:45 2016 +0100
1.2 +++ b/lib/__builtins__/unicode.py Thu Dec 15 01:40:31 2016 +0100
1.3 @@ -130,6 +130,37 @@
1.4 finally:
1.5 from_utf8.close()
1.6
1.7 + def join(self, l):
1.8 +
1.9 + "Join the elements in 'l' with this string."
1.10 +
1.11 + # Empty strings just cause the list elements to be concatenated.
1.12 +
1.13 + nonempty = self.__bool__()
1.14 +
1.15 + # Non-empty strings join the elements together in a buffer.
1.16 +
1.17 + b = buffer()
1.18 + first = True
1.19 + encoding = self.encoding
1.20 +
1.21 + for s in l:
1.22 + if first:
1.23 + first = False
1.24 + elif nonempty:
1.25 + b.append(self)
1.26 +
1.27 + if _isinstance(s, utf8string):
1.28 + encoding = None
1.29 +
1.30 + b.append(s)
1.31 +
1.32 + s = str(b)
1.33 + if encoding:
1.34 + s = utf8string(s)
1.35 + s.encoding = encoding
1.36 + return s
1.37 +
1.38 def unicode(s, encoding):
1.39
1.40 "Convert 's' to a Unicode object, interpreting 's' as using 'encoding'."