diff -r d18d50df6af0 Lib/statistics.py --- a/Lib/statistics.py Sat Feb 08 08:29:00 2014 +1100 +++ b/Lib/statistics.py Sat Feb 08 08:36:14 2014 +1100 @@ -251,9 +251,7 @@ def _counts(data): # Generate a table of sorted (value, frequency) pairs. - if data is None: - raise TypeError('None is not iterable') - table = collections.Counter(data).most_common() + table = collections.Counter(iter(data)).most_common() if not table: return table # Extract the values with the highest frequency. diff -r d18d50df6af0 Lib/test/test_statistics.py --- a/Lib/test/test_statistics.py Sat Feb 08 08:29:00 2014 +1100 +++ b/Lib/test/test_statistics.py Sat Feb 08 08:36:14 2014 +1100 @@ -1375,6 +1375,14 @@ # collections.Counter, which accepts None and returns an empty dict. self.assertRaises(TypeError, self.func, None) + def test_counter_data(self): + # Test that a Counter is treated like any other iterable. + data = collections.Counter([1, 1, 1, 2]) + # Since the keys of the counter are treated as data points, not the + # counts, this should raise. + self.assertRaises(statistics.StatisticsError, self.func, data) + + # === Tests for variances and standard deviations ===