Bruce Leban wrote:
result = "" for x in items: result += str(x) interstitially: result += ", " contrariwise: result = "no data"
We already have statements that only apply within loops (break and continue), how about some expressions that only apply in for loops: 'last' and 'empty':
for x in items: result += str(x) if not last: result += ', ' else: if empty: result = "no data"
-bruce (not to be confused with Bruce :-)