def __imul__(self, that):
"""
Increase the length of the list by appending *that* shallow copies of
each item.
"""
values = reduce(iadd, self._lists, []) * that
self._clear()
self._update(values)
return self
python类iadd()的实例源码
def __add__(self, that):
"""
Return a new sorted list containing all the elements in *self* and
*that*. Elements in *that* do not need to be properly ordered with
respect to *self*.
"""
values = reduce(iadd, self._lists, [])
values.extend(that)
return self.__class__(values, key=self._key, load=self._load)
def __imul__(self, that):
"""
Increase the length of the list by appending *that* shallow copies of
each item.
"""
values = reduce(iadd, self._lists, []) * that
self._clear()
self._update(values)
return self
def __add__(self, that):
"""
Return a new sorted list containing all the elements in *self* and
*that*. Elements in *that* do not need to be properly ordered with
respect to *self*.
"""
values = reduce(iadd, self._lists, [])
values.extend(that)
return self.__class__(values, load=self._load)
def __mul__(self, that):
"""
Return a new sorted list containing *that* shallow copies of each item
in SortedList.
"""
values = reduce(iadd, self._lists, []) * that
return self.__class__(values, load=self._load)
def __imul__(self, that):
"""
Increase the length of the list by appending *that* shallow copies of
each item.
"""
values = reduce(iadd, self._lists, []) * that
self._clear()
self._update(values)
return self
def __mul__(self, that):
"""
Return a new sorted list containing *that* shallow copies of each item
in SortedListWithKey.
"""
values = reduce(iadd, self._lists, []) * that
return self.__class__(values, key=self._key, load=self._load)
def __imul__(self, that):
"""
Increase the length of the list by appending *that* shallow copies of
each item.
"""
values = reduce(iadd, self._lists, []) * that
self._clear()
self._update(values)
return self
def __add__(self, that):
"""
Return a new sorted list containing all the elements in *self* and
*that*. Elements in *that* do not need to be properly ordered with
respect to *self*.
"""
values = reduce(iadd, self._lists, [])
values.extend(that)
return self.__class__(values, load=self._load)
def __mul__(self, that):
"""
Return a new sorted list containing *that* shallow copies of each item
in SortedList.
"""
values = reduce(iadd, self._lists, []) * that
return self.__class__(values, load=self._load)
def __imul__(self, that):
"""
Increase the length of the list by appending *that* shallow copies of
each item.
"""
values = reduce(iadd, self._lists, []) * that
self._clear()
self._update(values)
return self
def __add__(self, that):
"""
Return a new sorted list containing all the elements in *self* and
*that*. Elements in *that* do not need to be properly ordered with
respect to *self*.
"""
values = reduce(iadd, self._lists, [])
values.extend(that)
return self.__class__(values, key=self._key, load=self._load)
def __imul__(self, that):
"""
Increase the length of the list by appending *that* shallow copies of
each item.
"""
values = reduce(iadd, self._lists, []) * that
self._clear()
self._update(values)
return self
def __add__(self, that):
"""
Return a new sorted list containing all the elements in *self* and
*that*. Elements in *that* do not need to be properly ordered with
respect to *self*.
"""
values = reduce(iadd, self._lists, [])
values.extend(that)
return self.__class__(values, load=self._load)
def __mul__(self, that):
"""
Return a new sorted list containing *that* shallow copies of each item
in SortedList.
"""
values = reduce(iadd, self._lists, []) * that
return self.__class__(values, load=self._load)
def __imul__(self, that):
"""
Increase the length of the list by appending *that* shallow copies of
each item.
"""
values = reduce(iadd, self._lists, []) * that
self._clear()
self._update(values)
return self
def __mul__(self, that):
"""
Return a new sorted list containing *that* shallow copies of each item
in SortedListWithKey.
"""
values = reduce(iadd, self._lists, []) * that
return self.__class__(values, key=self._key, load=self._load)
def __imul__(self, that):
"""
Increase the length of the list by appending *that* shallow copies of
each item.
"""
values = reduce(iadd, self._lists, []) * that
self._clear()
self._update(values)
return self
def as_list(self):
"""Very efficiently convert the SortedList to a list."""
return reduce(iadd, self._lists, [])
def as_list(self):
"""Very efficiently convert the SortedList to a list."""
return reduce(iadd, self._lists, [])