Here's part of my Python code:
pstat1 = [plotvex(alpha,beta,j)[0] for j in range(5)]
ptset1 = [plotvex(alpha,beta,j)[1] for j in range(5)]
where plotvex
is a function that returns 2 items. I want to generate two lists pstat1
and ptset1
using list comprehension, but I wonder is there a way I don't need to call the function twice? Thanks:)