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,

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)

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

Re: [Python-ideas] Add a __cite__ method for scientific packages

2018-06-29 Thread Matt Arcidy
On Fri, Jun 29, 2018, 17:14 Andrei Kucharavy wrote: > One more thing. There's precedent for this: when you start an interactive >> Python interpreter it tells you how to get help, but also how to get >> copyright, credits and license information: >> >> $ python3 >> Python 3.6.6

Re: [Python-ideas] Add a __cite__ method for scientific packages

2018-06-29 Thread David Mertz
On Fri, Jun 29, 2018, 8:14 PM Andrei Kucharavy wrote: > Not all packages are within the numpy/scipy universe - Pandas and Seaborn are notable examples. Huh?! Pandas is a thin wrapper around NumPy. To be fair, it is a wrapper that adds a huge number of wrapping methods and classes. Seaborn in

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

2018-06-29 Thread Abe Dillon
[Michael Selik] > You might be pursuing a local optimum of obviousness. If you step back > from the idea of "initialize the counts with all interesting keys" and > looping over them, you might find a better overall solution. > That's a distinct possibility, but this is far from the first time

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

Re: [Python-ideas] Add a __cite__ method for scientific packages

2018-06-29 Thread Andrei Kucharavy
> > One more thing. There's precedent for this: when you start an interactive > Python interpreter it tells you how to get help, but also how to get > copyright, credits and license information: > > $ python3 > Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 26 2018, 19:50:54) > [GCC 4.2.1 Compatible Apple

[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

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

2018-06-29 Thread Abe Dillon
[Michael Selik] > You need an iterable of the keys you're interested in to pass to the > hypothetical ``fromkeys`` method. Why not iterate over that same iterable > paired with zeros instead of passing it into ``fromkeys``? > Because, as in my original example code; the values could be zero

Re: [Python-ideas] grouping / dict of lists

2018-06-29 Thread Michael Selik
On Fri, Jun 29, 2018 at 2:43 PM Guido van Rossum wrote: > On a quick skim I see nothing particularly objectionable or controversial > in your PEP, except I'm unclear why it needs to be a class method on `dict`. > Since it constructs a basic dict, I thought it belongs best as a dict constructor

Re: [Python-ideas] grouping / dict of lists

2018-06-29 Thread Guido van Rossum
On a quick skim I see nothing particularly objectionable or controversial in your PEP, except I'm unclear why it needs to be a class method on `dict`. Adding something to a builtin like this is rather heavy-handed. Is there a really good reason why it can't be a function in `itertools`? (I don't

Re: [Python-ideas] Fwd: Allow a group by operation for dict comprehension

2018-06-29 Thread Michael Selik
I created a separate thread to continue this discussion: "grouping / dict of lists" https://github.com/selik/peps/blob/master/pep-.rst In my proposal, the update offers a key-function in case the new elements don't follow the same pattern as the existing ones. I can understand the view that

Re: [Python-ideas] grouping / dict of lists

2018-06-29 Thread Michael Selik
Hello, I've drafted a PEP for an easier way to construct groups of elements from a sequence. https://github.com/selik/peps/blob/master/pep-.rst As a teacher, I've found that grouping is one of the most awkward tasks for beginners to learn in Python. While this proposal requires understanding

Re: [Python-ideas] Fwd: Allow a group by operation for dict comprehension

2018-06-29 Thread MRAB
On 2018-06-29 05:14, David Mertz wrote: Mike Selik asked for my opinion on a draft PEP along these lines. I proposed a slight modification to his idea that is now reflected in his latest edits. With some details fleshed out, I think this is a promising idea. I like the a collections class

Re: [Python-ideas] Add a __cite__ method for scientific packages

2018-06-29 Thread Nathan Goldbaum
On Thu, Jun 28, 2018 at 11:26 PM, Alex Walters wrote: > But don't all the users who care about citing modules already use the > scientific python packages, with scipy itself at it's center? Wouldn't > those engaging in science or in academia be better stewards of this than > systems

Re: [Python-ideas] list configuration

2018-06-29 Thread Brett Cannon
And I've taken owners off because I don't know how to solve this short of removing Google Groups somehow or getting off of email and switching to Zulip or Discourse. If someone has a solution that doesn't require dropping email then let me know. On Fri, Jun 29, 2018, 04:17 Stephen J. Turnbull, <

Re: [Python-ideas] Allow a group by operation for dict comprehension

2018-06-29 Thread Nicolas Rolin
A syntax that would work (which atm is a syntax error, and requires no new keyword) would be student_by_school = {school: [student] for school, student in student_school_list, grouped=True} with grouped=True being a modifier on the dict comprehension so that at each iteration loop

[Python-ideas] list configuration

2018-06-29 Thread Stephen J. Turnbull
I've cc'd python-ideas-owner, the folks who can actually do something about it. Chris Barker via Python-ideas writes: > I've been replying to messages lately, and getting a bounce back: [...] > And it's not quite clar to me if the message actually got through. In my experience it does,

Re: [Python-ideas] list configuration

2018-06-29 Thread Jacco van Dorp
I've had it to, bounces when attempting to reply or reply all, and it tried to send to some google groups version. 2018-06-28 19:31 GMT+02:00 Eric Fahlgren : > I've been getting those, too, but from the wxPython-dev group. I concur > that they look like googlegroups bounces (although I can't