Lichen

Change of lib/__builtins__/list.py

799:88933212404b
lib/__builtins__/list.py
     1.1 --- a/lib/__builtins__/list.py	Mon Apr 03 01:36:47 2017 +0200
     1.2 +++ b/lib/__builtins__/list.py	Mon Apr 03 01:37:06 2017 +0200
     1.3 @@ -113,6 +113,27 @@
     1.4              self.extend(other)
     1.5          return self
     1.6  
     1.7 +    def __mul__(self, other):
     1.8 +
     1.9 +        "Replicate this sequence 'other' times."
    1.10 +
    1.11 +        return self._mul(list(self), other)
    1.12 +
    1.13 +    def __imul__(self, other):
    1.14 +
    1.15 +        "Replicate this list 'other' times."
    1.16 +
    1.17 +        return self._mul(self, other)
    1.18 +
    1.19 +    def _mul(self, l, other):
    1.20 +
    1.21 +        "Replicate 'l' 'other' times."
    1.22 +
    1.23 +        while other > 1:
    1.24 +            l.extend(self)
    1.25 +            other -= 1
    1.26 +        return l
    1.27 +
    1.28      def __str__(self):
    1.29  
    1.30          "Return a string representation."