Ask Your Question

Revision history [back]

Indexing variables in a list comprehension

Suppose I create the polynomial ring R = PolynomialRing(QQ, ['lambda%s'%i for i in [1 .. g]] + ['psi%s'%i for i in [1 .. n]]).

If I want to create a list comprehension which creates a list of perhaps all the lambdas, what is the notation used at the beginning of the list comprehension?

i.e. [lambdai for i in [1 .. g]].