[issue32770] collections.counter examples are misleading

2018-02-05 Thread Anthony Flury
Anthony Flury added the comment: Cheryl : When you iterate around a counter instance it does return keys in the order they are first encountered/inserted - so I agree with you that it is an ordered collection from Python 3.7 onwards (although the iteration and

[issue32770] collections.counter examples are misleading

2018-02-05 Thread Cheryl Sabella
Cheryl Sabella added the comment: You know, I'm not sure if I had ever seen that example before. When you click Counter at the top of the page, it goes right to the class definition, which is past the example. Having said that, I really like the example. Until now, I

[issue32770] collections.counter examples are misleading

2018-02-05 Thread Anthony Flury
Anthony Flury added the comment: Raymond, I completely understand your comment but I do disagree. My view would be that the documentation of the stdlib should document the entry level use cases. The first example given uses nothing special from the Counter class

[issue32770] collections.counter examples are misleading

2018-02-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for the suggestion. I respectfully disagree. The "core" functionality of Counter is the ability to write c['x'] += 1 without risking a KeyError. The add-on capability is to process an entire iterable all at once.

[issue32770] collections.counter examples are misleading

2018-02-04 Thread Anthony Flury
New submission from Anthony Flury : The first example given for collections.Counter is misleading - the documentation ideally should show the 'best' (one and only one) way to do something and the example is this : >>> # Tally occurrences of words in a list >>>