On Fri, Jul 13, 2018 at 12:38 PM, Michael Selik wrote:
> Thanks for linking to these.
>
yup -- real use cases are really helpful.
Though the other paradigm for grouping is use of setdefault() rather than
defaultdict. So it would be nice to look for those, too.
> I looked at many of them in
Thanks for linking to these. I looked at many of them in my own research,
but for some reason didn't think to write down the links. I'll respond to
each one separately.
Throughout, I'm going to use my proposed ``grouped`` builtin to demonstrate
possible revisions. Note that I am *not* suggesting
I noticed recently that *all* examples for collection.defaultdict (
https://docs.python.org/3.7/library/collections.html#collections.defaultdict)
are cases of grouping (for an int, a list and a set) from an iterator with
a key, value output.
I wondered how common those constructions were, and
On Mon, Jul 9, 2018 at 5:55 PM, Franklin? Lee wrote:
> >> - The storage container.
> >
> >
> > so this means you'r passing in a full set of storage containers? I'm a
> vit
> > confused by that -- if they might be pre-populated, then they would need
> to
> > be instance,s an you'd need to have
On Mon, Jul 9, 2018 at 3:38 PM, David Mertz wrote:
> In my mind, I *rarely* (which is more than never) have my data in the form
> of a sequence of key/value pairs. The version of the API that assumes data
> starts that way feels like either a niche case, or demands preprocessing
> before it's
On Mon, Jul 9, 2018 at 12:22 PM, Chris Barker wrote:
> On Fri, Jul 6, 2018 at 12:26 PM, Franklin? Lee I use this kind of function
>> I added several options, such as:
>> - key function
>> - value function
>> - "ignore": Skip values with these keys.
>> - "postprocess": Apply a function to each
In my mind, I *rarely* (which is more than never) have my data in the form
of a sequence of key/value pairs. The version of the API that assumes data
starts that way feels like either a niche case, or demands preprocessing
before it's ready to pass to grouping() or collections.Grouping().
That
On Fri, Jul 6, 2018 at 12:26 PM, Franklin? Lee I use this kind of function
in several different projects over the
>
> years, and I rewrote it many times as needed.
>
> I added several options, such as:
> - key function
> - value function
> - "ignore": Skip values with these keys.
> -
On Thu, Jul 5, 2018 at 1:23 AM, Chris Barker via Python-ideas
wrote:
> On Wed, Jul 4, 2018 at 6:34 AM, David Mertz wrote:
>
>>
>> You've misunderstood part of the discussion. There are two different
>> signatures being discussed/proposed for a grouping() function.
>>
>> The one you show we might
On Wed, Jul 4, 2018 at 6:34 AM, David Mertz wrote:
> You've misunderstood part of the discussion. There are two different
> signatures being discussed/proposed for a grouping() function.
>
> The one you show we might call grouping_michael(). The alternate API we
> might call grouping_chris().
There are some cases when that's the correct behavior. It mimics
pandas.DataFrame.groupby. For example, what if you have a sequence of (key,
v1, v2) triples? Group by key, then keep the triples intact is the right
choice sometimes.
On Wed, Jul 4, 2018, 6:39 AM David Mertz wrote:
> Steven:
>
>
Steven:
You've misunderstood part of the discussion. There are two different
signatures being discussed/proposed for a grouping() function.
The one you show we might call grouping_michael(). The alternate API we
might call grouping_chris(). These two calls will produce the same result
(the first
On Sun, Jul 1, 2018 at 9:36 PM, Chris Barker wrote:
> hmm, makes we wonder if it would make sense to update my implementation to
> allow mapping types as well for the collection
>
general mapping types don't make sense -- but I added Counter. Which is a
pretty special case, so I think it
On Sun, Jul 1, 2018 at 7:12 PM, David Mertz wrote:
> Michael changed from set to list at my urging. A list is more general. A
> groupby in Pandas or SQL does not enforce uniqueness, but DOES preserve
> order.
>
It really is better to construct the collection using lists—in the fully
general
On Sun, Jul 1, 2018 at 7:28 PM, David Mertz wrote:
> But it's pretty simple. Whether my idea of collections.Grouping is adapted
> or whether a function/classmethod grouping() produces a plain dictionary,
>
or my custom class...
> the casting would be the same:
>
> {k:set(v) for k,v in
Oh, it looks like he has modified the PEP and taken out the examples of
conversion. That's too bad, hopefully they'll be added back.
But it's pretty simple. Whether my idea of collections.Grouping is adapted
or whether a function/classmethod grouping() produces a plain dictionary,
the casting
Michael changed from set to list at my urging. A list is more general. A
groupby in Pandas or SQL does not enforce uniqueness, but DOES preserve
order. I think the PEP is not fully updated, but it's a list everywhere in
the proposal itself, just not in the "old techniques."
Moreover, Michael
Ivan,
Did you mean this to go to the list? I hope so, as I've cc-d it this time
:-)
On Sun, Jul 1, 2018 at 1:20 AM, Ivan Levkivskyi
wrote:
> On 1 July 2018 at 06:18, Chris Barker via Python-ideas <
> python-ideas@python.org> wrote:
>
>> I'm really warming to the:
>>
>> Alternate:
18 matches
Mail list logo