2009/9/17 Roberto Alsina <ralsina@netmanagers.com.ar>
A ver...

def firstTrue():
       yield True
       while True:
               yield False

ft=firstTrue()
print ft.next()
print ft.next()
print ft.next()

Produce

True
False
False

y es un poco más pitónico ;-)

A ver... entonces quedaría así?

edad = None
def edadInvalida():
    yield True
    while not edad.isdigit():
        print "No es un número"
        yield True
for i in edadInvalida():
    edad = raw_input("Edad plis: ")

Hay algo que no me gusta de eso. No puedo decir exactamente qué... pero algo me huele feo.

 
--
 ("\''/").__..-''"`-. .         Roberto Alsina
 `9_ 9  )   `-. (    ).`-._.`)  KDE Developer (MFCH)
 (_Y_.)' ._   ) `._`.  " -.-'  http://lateral.netmanagers.com.ar
 _..`-'_..-_/ /-'_.'     The 6,855th most popular site of Slovenia
(l)-'' ((i).' ((!.'       according to alexa.com (27/5/2007)

---------------------------------------------------------------------
Para dar de baja la suscripcion, mande un mensaje a:
  pyar-unsubscribe@decode.com.ar

Para obtener el resto de direcciones-comando, mande un mensaje a:
  pyar-help@decode.com.ar

PyAr - Python Argentina - Sitio web: http://www.python.com.ar/