Commit 04e0db00 authored by j-mark-hou's avatar j-mark-hou Committed by Guolin Ke
Browse files

now use set instead of list in python package basic.Dataset.get_ref_chain (#758)

parent 399710ac
......@@ -1185,17 +1185,17 @@ class Dataset(object):
chain of references of self : set of Dataset objects
'''
head = self
ref_chain = []
ref_chain = set()
while len(ref_chain) < ref_limit:
if isinstance(head, Dataset):
ref_chain += [head]
ref_chain.add(head)
if (head.reference is not None) and (head.reference not in ref_chain):
head = head.reference
else:
break
else:
break
return(set(ref_chain))
return(ref_chain)
class Booster(object):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment