[OT] Number theory [Was: A use for integer quotients]

Moshe Zadka m at moshez.org
Mon Jul 30 10:43:48 CEST 2001


On 30 Jul 2001, Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> wrote:

> I would write it
>       print "There %s %d error%s." % (if n==1 then ('was',  n, '')
>                                               else ('were', n, 's'))

The correct way to write it is:

print ["There was %d error", "There were %d errors"][n>1] % n

This way, making this application translatable is a piece of cake.
The other version can't be translated properly.
As someone from a non-English speaking country, you should care.
-- 
gpg --keyserver keyserver.pgp.com --recv-keys 46D01BD6 54C4E1FE
Secure (inaccessible): 4BD1 7705 EEC0 260A 7F21  4817 C7FC A636 46D0 1BD6
Insecure (accessible): C5A5 A8FA CA39 AB03 10B8  F116 1713 1BCF 54C4 E1FE
Learn Python! http://www.ibiblio.org/obp/thinkCSpy




More information about the Python-list mailing list