swap.py 文件源码

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

项目:ropf 作者: kevinkoo001 项目源码 文件源码
def get_swap_subset(self, subset, other):
        # get a copy of subset!
        subset = subset.copy()
        # print "will check", self.name, other.name, "in", subset

        for lifetime in itertools.cycle((self, other)):
            old_size = subset.size
            for sg in lifetime.subsets:
                if sg.intersects(subset):
                    # print "\t", sg, "intersects", subset
                    if sg.no_swap:
                        # print "\tsg is no swap .. bail out"
                        return None
                    # print "\tmerging them!"
                    subset.merge(sg)
            if subset.size == old_size:
                # print "\tsize did not change, done!"
                break

        return subset
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号