bob gailer wrote:
> The terse version:
> 
> list.append({'id': 'name', 'link': ('XX','YY')[total > 0]})

I think you have it backwards:
In [1]: total=0
In [2]: ('XX','YY')[total > 0]
Out[2]: 'XX'
In [3]: total=1
In [4]: ('XX','YY')[total > 0]
Out[4]: 'YY'

Try
   list.append({'id': 'name', 'link': ('YY','XX')[total > 0]})

Or, in Python 2.5,
   list.append({'id': 'name', 'link': ('XX' if total > 0 else 'YY')})

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to