Rewrite without using try-except to break out of two loops.

This commit is contained in:
Guido van Rossum 1996-12-11 16:28:30 +00:00
parent 870d5c67ae
commit 2b6c2faa64

View file

@ -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