杨辉三角
def triangles():
prev_line = [1]
while True:
yield prev_line
result = [1]
if len(prev_line) == 1:
result.append(1)
if len(prev_line) > 1:
for i in range(len(prev_line)-1):
result.append(prev_line[i]+prev_line[i+1])
result.append(1)
prev_line = result