Hey everyone, I recently used list.count() in a coding interview and the question arose about how scale-able this solution was for sufficiently large input. Currently, list.count iterates through the list, incrementing the count as it goes and returning the value at the end. This does not lend itself well to large inputs.
I propose either modifying the list struct to include a map of item -> count, or implementing a new structure with this information that is allocated separately when a list is instantiated. Maybe I'm just seeing this since it's an edge case that I recently dealt with, but I believe it would be a useful enhancement overall. Thoughts?
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/MLQPPKQ2LB4TSHSCRI3V3EFQAPIJLRXH/ Code of Conduct: http://python.org/psf/codeofconduct/