uniq_stable(elems) -> list Return from an iterable, a list of all the unique elements in the input, but maintaining the order in which they first appear. Note: All elements in the input must be hashable for this routine to work, as it internally uses a set for efficiency reasons.
(elems)
| 11 | |
| 12 | |
| 13 | def uniq_stable(elems): |
| 14 | """uniq_stable(elems) -> list |
| 15 | |
| 16 | Return from an iterable, a list of all the unique elements in the input, |
| 17 | but maintaining the order in which they first appear. |
| 18 | |
| 19 | Note: All elements in the input must be hashable for this routine |
| 20 | to work, as it internally uses a set for efficiency reasons. |
| 21 | """ |
| 22 | seen = set() |
| 23 | return [x for x in elems if x not in seen and not seen.add(x)] |
| 24 | |
| 25 | |
| 26 | def chop(seq, size): |