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

2018-07-04 Thread Chris Barker via Python-ideas
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(). Th

Re: [Python-ideas] Where should grouping() live (was: grouping / dict of lists)

2018-07-04 Thread Chris Barker via Python-ideas
On Tue, Jul 3, 2018 at 6:23 AM, David Mertz wrote: > Guido said he has mooted this discussion > ... But before putting it on auto-archive, the BDFL said (1) NO GO on getting a new builtin; (2) NO OBJECTION to putting it in itertools. I don't recall him offering an opinion on a class in collect

Re: [Python-ideas] Where should grouping() live (was: grouping / dict of lists)

2018-07-04 Thread Chris Barker via Python-ideas
On Wed, Jul 4, 2018 at 3:53 AM, INADA Naoki wrote: > But if it happens, I'm -1 on functools and collections. > They are used very much. Every Python tool import them regardless how > much of their contents are used. > really? collections? what for? I'm guessing namedtuple and maybe deque. But

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

2018-07-04 Thread Wes Turner
typeshed, dotted lookup, ScholarlyArticle semantic graphs with classes, properties, and URIs Would external metadata (similar to how typeshed is defined in a 'shadow naming scheme' (?)) be advantageous for dotted name lookup of citation metadata? > Typeshed contains external type annotations for

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

2018-07-04 Thread Wes Turner
... a schema:Dataset may be part of a Creative work. https://schema.org/Dataset https://schema.org/isPartOf https://schema.org/ScholarlyArticle #LinkedReproducibility #nbmeta On Wednesday, July 4, 2018, Wes Turner wrote: > https://schema.org/CreativeWork > https://schema.org/Code > https:/

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

2018-07-04 Thread Wes Turner
https://schema.org/CreativeWork https://schema.org/Code https://schema.org/SoftwareApplication CreativeWork has a https://schema.org/citation field with a range of {CreativeWork, Text} There's also a https://schema.org/funder attribute with a domain of CreativeWork and a range of {Organizatio

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

2018-07-04 Thread Alexander Belopolsky
On Sun, Jul 1, 2018 at 9:45 AM David Mertz wrote: > .. > There's absolutely nothing in the idea that requires a change in Python, > and Python developers or users are not, as such, the relevant experts. > This is not entirely true. If some variant of __citation__ is endorsed by the community, I

Re: [Python-ideas] Where should grouping() live (was: grouping / dict of lists)

2018-07-04 Thread Michael Selik
On Wed, Jul 4, 2018, 3:11 AM Ivan Levkivskyi wrote: > Replying to the question in subject, I think it would be better in > collections as a class. > Having it just as a function doesn't buy much, because one can do the > same with three lines and a defaultdict. > Four lines. You'll need to conv

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

2018-07-04 Thread Michael Selik
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: > > Y

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

2018-07-04 Thread David Mertz
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

Re: [Python-ideas] Where should grouping() live (was: grouping / dict of lists)

2018-07-04 Thread INADA Naoki
I'm -1 on adding it in stdlib. But if it happens, I'm -1 on functools and collections. They are used very much. Every Python tool import them regardless how much of their contents are used. On the other hand, itertools contains random stuff very rarely used. If you really want to add it in coll

Re: [Python-ideas] Where should grouping() live (was: grouping / dict of lists)

2018-07-04 Thread Ivan Levkivskyi
On 4 July 2018 at 11:25, Steven D'Aprano wrote: > On Wed, Jul 04, 2018 at 11:08:05AM +0100, Ivan Levkivskyi wrote: > > Replying to the question in subject, I think it would be better in > > collections as a class. > > Having it just as a function doesn't buy much, because one can do the > same >

Re: [Python-ideas] Where should grouping() live (was: grouping / dict of lists)

2018-07-04 Thread Steven D'Aprano
On Wed, Jul 04, 2018 at 11:08:05AM +0100, Ivan Levkivskyi wrote: > Replying to the question in subject, I think it would be better in > collections as a class. > Having it just as a function doesn't buy much, because one can do the same > with three lines and a defaultdict. > However, if this is a

Re: [Python-ideas] Where should grouping() live (was: grouping / dict of lists)

2018-07-04 Thread Ivan Levkivskyi
Replying to the question in subject, I think it would be better in collections as a class. Having it just as a function doesn't buy much, because one can do the same with three lines and a defaultdict. However, if this is a class it can support adding new elements, merge the groupeddicts, etc. --