mirror of
https://github.com/python/cpython.git
synced 2025-11-26 21:33:10 +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,21 +5,22 @@ 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:
|
||||||
|
print nismap
|
||||||
|
mapping = nis.cat(nismap)
|
||||||
|
for k, v in mapping.items():
|
||||||
if verbose:
|
if verbose:
|
||||||
print nismap
|
print ' ', k, v
|
||||||
mapping = nis.cat(nismap)
|
if not k:
|
||||||
for k, v in mapping.items():
|
continue
|
||||||
if verbose:
|
if nis.match(k, nismap) <> v:
|
||||||
print ' ', k, v
|
print "NIS match failed for key `%s' in map `%s'" % (k, nismap)
|
||||||
if not k:
|
else:
|
||||||
continue
|
# just test the one key, otherwise this test could take a
|
||||||
if nis.match(k, nismap) <> v:
|
# very long time
|
||||||
print "NIS match failed for key `%s' in map `%s'" % (k, nismap)
|
done = 1
|
||||||
else:
|
break
|
||||||
# just test the one key, otherwise this test could take a
|
if done:
|
||||||
# very long time
|
break
|
||||||
raise 'done'
|
|
||||||
except 'done':
|
|
||||||
pass
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue