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

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Mon Jul 30 07:55:59 CEST 2001


Sun, 29 Jul 2001 22:20:09 GMT, Bengt Richter <bokr at accessone.com> pisze:

> BTW, note the usefulness of boolean-as-integer returned from
> comparison operators, if you want to be picky about plurals:
> 
>     print "There %s %d error%s." % ( ['were','was'][n==1], n, 's'*(n!=1) ) 

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

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list