def maybePage(lst):
screenSize = getScreenSize()
# be more intelligent about it
doPage = None
if screenSize:
# count the number of lines the text would use up on the screen
# (taking care of lines longer than the terminal width)
doPage = sum( \
map(lambda x: \
sum( map(lambda y: \
int(math.ceil(float(len(y) if len(y) else 1)/float(screenSize[1]))), x.split('\n') \
) \
), lst \
)) > screenSize[0]
if doPage or not screenSize:
pydoc.pager("\n".join(lst))
else:
def p(x):
print x
map(p, lst)
评论列表
文章目录