On Thu, Feb 4, 2010 at 4:59 AM, Jean-Michel Pichavant <
jeanmic...@sequans.com> wrote:
> What the hell is this 'for else' loop !! :D First time I see this statement
> for years.
> I'd never thought I'd still learn something that basic.
>
Its one of the least used constructs in Python, I think, an
Jean-Michel Pichavant wrote:
MRAB wrote:
In other words:
for attempt in range(2):
try:
spanish_field = translate(english_field, lang_to='es',
lang_from='en')
break
except TranslationError:
pass
else:
# Didn't break out of the loop, therefore not successful.
MRAB wrote:
In other words:
for attempt in range(2):
try:
spanish_field = translate(english_field, lang_to='es',
lang_from='en')
break
except TranslationError:
pass
else:
# Didn't break out of the loop, therefore not successful.
print "Translation failed
* MRAB:
Alf P. Steinbach wrote:
* mf:
I'm translating a db from english to spanish with the Google
translator API. The problem is when a TranslationError occurs(usually
because of connection problems). I can
except the first one, but I don't know how to except again. I "solved"
the problem by s
Alf P. Steinbach wrote:
* mf:
I'm translating a db from english to spanish with the Google
translator API. The problem is when a TranslationError occurs(usually
because of connection problems). I can
except the first one, but I don't know how to except again. I "solved"
the problem by saving tem
* mf:
I'm translating a db from english to spanish with the Google
translator API. The problem is when a TranslationError occurs(usually
because of connection problems). I can
except the first one, but I don't know how to except again. I "solved"
the problem by saving temp db's and then joining t