Show More
@@ -23,12 +23,6 b' def uniq_stable(elems):' | |||||
23 | return [x for x in elems if x not in seen and not seen.add(x)] |
|
23 | return [x for x in elems if x not in seen and not seen.add(x)] | |
24 |
|
24 | |||
25 |
|
25 | |||
26 | def flatten(seq): |
|
|||
27 | """Flatten a list of lists (NOT recursive, only works for 2d lists).""" |
|
|||
28 |
|
||||
29 | return [x for subseq in seq for x in subseq] |
|
|||
30 |
|
||||
31 |
|
||||
32 | def chop(seq, size): |
|
26 | def chop(seq, size): | |
33 | """Chop a sequence into chunks of the given size.""" |
|
27 | """Chop a sequence into chunks of the given size.""" | |
34 | return [seq[i:i+size] for i in range(0,len(seq),size)] |
|
28 | return [seq[i:i+size] for i in range(0,len(seq),size)] |
General Comments 0
You need to be logged in to leave comments.
Login now