substitute for c/java's ?:

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Fri Jun 22 10:52:57 EDT 2001


22 Jun 2001 13:10:21 +0200, piet at cs.uu.nl <piet at cs.uu.nl> pisze:

> MK> def aan(name):
> MK>     """Utility which returns 'a' or 'an' for a given noun.
> MK>     """
> MK>     return if string.lower(name[0]) in 'aeiou' then 'an ' else 'a '
> 
> Which programming language is that? 

Hypothetical Python with if/then/else as an expression.

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



More information about the Python-list mailing list