On Sep 25, 3:16 am, Pete Forman <[EMAIL PROTECTED]> wrote: > Asun Friere <[EMAIL PROTECTED]> writes: > > > A canonical use of the conditional operator is in > > pluralising words, (eg. '%s dollar' % n + 's' if n!=1 else ''). > > That fails for n == 1. So what is best? >
Sorry missing parentheses. I should test before posting, even for code written into. > for i in range(4): > print '%d thing' % i + ('s' if i != 1 else '') That is the correct version of what I meant, but your last, including all variables for placeholders in the tuple is probably better. -- http://mail.python.org/mailman/listinfo/python-list