1 parent d1cbca9 commit ced2835Copy full SHA for ced2835
1 file changed
yield/fab.py
@@ -66,3 +66,17 @@ def fab2(max):
66
67
print(isinstance(fab2, types.GeneratorType))
68
print(isinstance(fab2(5), types.GeneratorType))
69
+
70
+from collections import Iterable
71
+print(isinstance(fab2, Iterable))
72
+print(isinstance(fab2(5), Iterable))
73
74
+def read_file(fpath):
75
+ BLOCK_SIZE = 1024
76
+ with open(fpath, 'rb') as f:
77
+ while True:
78
+ block = f.read(BLOCK_SIZE)
79
+ if block:
80
+ yield block
81
+ else:
82
+ return
0 commit comments