Kaydet (Commit) 2b6c2faa authored tarafından Guido van Rossum's avatar Guido van Rossum

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

üst 870d5c67
...@@ -5,21 +5,22 @@ if __name__ == '__main__': ...@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment