min max of a list
Peter Hansen
peter at engcorp.com
Fri May 6 16:33:37 EDT 2005
querypk at gmail.com wrote:
> I get a syntax error in :
>
> py> [(min((abs(p - v), v) for v in valleys + [0] if v < p)[1],
> ... p,
> ... min((abs(p - v), v) for v in valleys if v > p)[1])
> ... for p in peaks]
I think we already covered the part where you were using an older
version of Python. In this case, the missing feature is "generator
expressions" and they are inside the two min() calls.
You might want to consider upgrading...
-Peter
More information about the Python-list
mailing list