diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-12-18 21:09:40 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-18 21:09:40 -0800 |
commit | 22c8673dd2cb62d372cb1882b6a6d0ec9d029b2c (patch) | |
tree | 5b0b276425fdfbb6767690a053c0bbe83e9c74de /numpy | |
parent | e6133b3a3f5382ec0badcfe0b6e069e05ea6e253 (diff) | |
download | numpy-22c8673dd2cb62d372cb1882b6a6d0ec9d029b2c.tar.gz |
Rename OrderedCounter to _OrderedCounter
Let's not add to the namespace
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/records.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/core/records.py b/numpy/core/records.py index c777b30a9..4d18c5712 100644 --- a/numpy/core/records.py +++ b/numpy/core/records.py @@ -76,7 +76,7 @@ numfmt = nt.typeDict # taken from OrderedDict recipes in the Python documentation # https://docs.python.org/3.3/library/collections.html#ordereddict-examples-and-recipes -class OrderedCounter(Counter, OrderedDict): +class _OrderedCounter(Counter, OrderedDict): """Counter that remembers the order elements are first encountered""" def __repr__(self): @@ -85,11 +85,12 @@ class OrderedCounter(Counter, OrderedDict): def __reduce__(self): return self.__class__, (OrderedDict(self),) + def find_duplicate(list): """Find duplication in a list, return a list of duplicated elements""" return [ item - for item, counts in OrderedCounter(list).items() + for item, counts in _OrderedCounter(list).items() if counts > 1 ] |