iterables.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:ww 作者: Tygs 项目源码 文件源码
def copy(self):
        # type: () -> IterableWrapper
        """ Return an exact copy of the iterable.

            The reference of the new iterable will be the same as the source
            when `copy()` was called.

            Example:

                >>> from ww import g
                >>> my_g_1 = g(range(3))
                >>> my_g_2 = my_g_1.copy()
                >>> next(my_g_1)
                0
                >>> next(my_g_1)
                1
                >>> next(my_g_2)
                0
        """

        self.iterator, new = itertools.tee(self.iterator)
        return self.__class__(new)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号