OILS / opy / misc / determinism.py View on Github | oilshell.org

39 lines, 21 significant
1#!/usr/bin/env python2
2from __future__ import print_function
3"""
4determinism.py
5"""
6
7import sys
8
9
10def main(argv):
11
12 s = set()
13 d = {}
14 with open(sys.argv[1]) as f:
15 for line in f:
16 d[line] = 1
17 #s.add(line)
18 print(hash(line))
19 #return
20
21 #for line in d:
22 # sys.stdout.write(line)
23
24 print(d.keys())
25 return
26 print('--')
27 for line in s:
28 sys.stdout.write(line)
29 # NOTE: Detects if set size changed during iteration.
30 #s.discard(line)
31 print('--')
32
33
34if __name__ == '__main__':
35 try:
36 main(sys.argv)
37 except RuntimeError as e:
38 print('FATAL: %s' % e, file=sys.stderr)
39 sys.exit(1)