mirror of
https://github.com/python/cpython.git
synced 2025-11-26 13:22:51 +00:00
Rewrite without using try-except to break out of two loops.
This commit is contained in:
parent
870d5c67ae
commit
2b6c2faa64
1 changed files with 18 additions and 17 deletions
|
|
@ -5,7 +5,7 @@ if __name__ == '__main__':
|
||||||
verbose = 1
|
verbose = 1
|
||||||
|
|
||||||
maps = nis.maps()
|
maps = nis.maps()
|
||||||
try:
|
done = 0
|
||||||
for nismap in maps:
|
for nismap in maps:
|
||||||
if verbose:
|
if verbose:
|
||||||
print nismap
|
print nismap
|
||||||
|
|
@ -20,6 +20,7 @@ try:
|
||||||
else:
|
else:
|
||||||
# just test the one key, otherwise this test could take a
|
# just test the one key, otherwise this test could take a
|
||||||
# very long time
|
# very long time
|
||||||
raise 'done'
|
done = 1
|
||||||
except 'done':
|
break
|
||||||
pass
|
if done:
|
||||||
|
break
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue