コード例 #1
0
ファイル: java_collections.py プロジェクト: mrfaheemkhan/py4j
    def __set_item_from_slice(self, indices, iterable):
        offset = 0
        last = 0
        value_iter = iter(iterable)

        # First replace and delete if from_slice > to_slice
        for i in range(*indices):
            try:
                value = next(value_iter)
                self.__set_item(i, value)
            except StopIteration:
                self.__del_item(i)
                offset -= 1
            last = i + 1

        # Then insert if from_slice < to_slice
        for elem in value_iter:
            self.insert(last, elem)
            last += 1
コード例 #2
0
    def __set_item_from_slice(self, indices, iterable):
        offset = 0
        last = 0
        value_iter = iter(iterable)

        # First replace and delete if from_slice > to_slice
        for i in range(*indices):
            try:
                value = next(value_iter)
                self.__set_item(i, value)
            except StopIteration:
                self.__del_item(i)
                offset -= 1
            last = i + 1

        # Then insert if from_slice < to_slice
        for elem in value_iter:
            self.insert(last, elem)
            last += 1
コード例 #3
0
ファイル: java_collections.py プロジェクト: mrfaheemkhan/py4j
 def __repl_item_from_slice(self, range, iterable):
     value_iter = iter(iterable)
     for i in range:
         value = value = next(value_iter)
         self.__set_item(i, value)
コード例 #4
0
 def __repl_item_from_slice(self, range, iterable):
     value_iter = iter(iterable)
     for i in range:
         value = value = next(value_iter)
         self.__set_item(i, value)