1.5.2 for: else:

Oleg Broytmann phd at emerald.netskate.ru
Tue Jul 27 08:15:44 EDT 1999


Hello!

   The following program:

----------
for a in ['a', 12]:
   print a
else:
   print "Empty!"
----------

   prints under 1.5.2 on Linux and Solaris:

-----
a
12
Empty!
-----

   Is it a bug, or is it just me, who do not understand the feature? I
expected just "a" and "12"...

   This:

----------
for a in []:
   print a
else:
   print "Empty!"
----------

   prints:

-----
Empty!
-----

   and I think it is correct.

Oleg.
---- 
    Oleg Broytmann        Netskate/Inter.Net.Ru        phd at emerald.netskate.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list