[issue25535] collections.Counter methods return Counter objects instead of subclass objects
Raymond Hettinger
report at bugs.python.org
Mon Nov 2 19:04:31 EST 2015
Raymond Hettinger added the comment:
The decision was deliberate and matches what we've done elsewhere in Python. The nearest kin to Counters are sets/frozensets which also behave the same way:
>>> class S(set):
pass
>>> type(S('abc') | S('cdef'))
<class 'set'>
Mark Dickinson articulated the reasons clearly. Python has been consistent about this decision from the outset (see array.array or fractions.Fraction for example).
Marking this as "not a bug" and closing.
----------
resolution: -> not a bug
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25535>
_______________________________________
More information about the Python-bugs-list
mailing list