Re: [Python-ideas] Fwd: collections.Counter should implement fromkeys

2018-06-30 Thread Tim Peters
[Abe Dillon] > I haven't been part of the conversation for 15 years, but most of the argument > against the idea (yours especially) seem to focus on the prospect of a > constructor war and imply that was the original motivation behind actively > disabling the fromkeys method in Counters. I quoted

Re: [Python-ideas] Fwd: collections.Counter should implement fromkeys

2018-06-29 Thread Abe Dillon
[Steven D'Aprano] > In the case where all the inital counts are zero, the obvious API is to > call the dict fromkeys method: > Counter(dict.fromkeys(['a', 'b', 'ab'], 0)) Yes, I've discussed this, but since my replies have been miss addressed, it may have gotten lost. I'll quote it below: [

Re: [Python-ideas] Fwd: collections.Counter should implement fromkeys

2018-06-29 Thread Raymond Hettinger
On Jun 29, 2018, at 5:32 PM, Abe Dillon wrote: > > Sure, but in Hettinger's own words "whenever you have a constructor war, > everyone should get their wish". People that want a counting constructor have > that, > people that want the ability to initialize values don't have that. Sorry Abe, bu

Re: [Python-ideas] Fwd: collections.Counter should implement fromkeys

2018-06-29 Thread Tim Peters
[ Note to repliers to Abe (and others recently): replies to Google Groups posts are broken for now on this list, so be sure to replace python-id...@googlegroups.com with python-ideas@python.org in your reply. Else the mailing list (neither Google Groups nor the python.org archive) won

Re: [Python-ideas] Fwd: collections.Counter should implement fromkeys

2018-06-29 Thread Steven D'Aprano
On Fri, Jun 29, 2018 at 05:32:54PM -0700, Abe Dillon wrote: > Sure, but in Hettinger's own words > "whenever you have a > constructor war, everyone should get their wish". People that want a > counting constructor have that, > people that w

Re: [Python-ideas] Fwd: collections.Counter should implement fromkeys

2018-06-29 Thread Abe Dillon
[Tim Peters] > a fundamental use case for Counters is to tally the _number_ of times > duplicate keys appear. > Yes, that's why the default constructor already does just that. [Tim Peters] > So, e.g., someone will be unpleasantly surprised no matter what Sure, but in Hettinger's own wor

[Python-ideas] Fwd: collections.Counter should implement fromkeys

2018-06-29 Thread Tim Peters
Reposting because the original got bounced from Google Groups. -- Forwarded message - From: Tim Peters Date: Fri, Jun 29, 2018 at 5:54 PM Subject: Re: [Python-ideas] collections.Counter should implement fromkeys To: Cc: python-ideas [Abe Dillon ] > ... > I'm using the copy-con