Re: [Python-ideas] Add recordlcass to collections module

2018-09-04 Thread Eric V. Smith
On 9/4/2018 3:03 PM, Chris Barker via Python-ideas wrote: Chiming in here: dataclasses was just added to the stdlib. I understand that record class is not the same thing, but the use cases do overlap a great deal. So I think the cord goal for anyone that wants to see this in the stdlib is

Re: [Python-ideas] Add recordlcass to collections module

2018-09-04 Thread Chris Barker via Python-ideas
Chiming in here: dataclasses was just added to the stdlib. I understand that record class is not the same thing, but the use cases do overlap a great deal. So I think the cord goal for anyone that wants to see this in the stdlib is to demonstrate tbat recordclass Adds significant enough value

Re: [Python-ideas] Add recordlcass to collections module

2018-09-04 Thread Zaur Shibzukhov
--- *Zaur Shibzukhov* 2018-09-03 1:02 GMT+03:00 Wes Turner : > > On Sunday, September 2, 2018, Zaur Shibzukhov wrote: > >> >> >> --- >> *Zaur Shibzukhov* >> >> >> 2018-09-02 22:11 GMT+03:00 Wes Turner : >> >>> Does the value of __hash__ change when attributes of a recordclass >>> change? >>>

Re: [Python-ideas] Add recordlcass to collections module

2018-09-03 Thread Zaur Shibzukhov
понедельник, 3 сентября 2018 г., 2:11:06 UTC+3 пользователь Greg Ewing написал: > > Zaur Shibzukhov wrote: > > > `Recordclass` is defined on top of` memoryslots` just like `namedtuple` > > above` tuple`. Attributes are accessed via a descriptor (`itemgetset`), > > which supports both`

Re: [Python-ideas] Add recordlcass to collections module

2018-09-03 Thread Wes Turner
On Mon, Sep 3, 2018 at 4:40 AM Chris Angelico wrote: > On Mon, Sep 3, 2018 at 6:31 PM, Wes Turner wrote: > > > > > > On Mon, Sep 3, 2018 at 4:17 AM Chris Angelico wrote: > >> > >> On Mon, Sep 3, 2018 at 5:23 PM, Jacco van Dorp > >> wrote: > >> > This feels really useful to me to make some

Re: [Python-ideas] Add recordlcass to collections module

2018-09-03 Thread Chris Angelico
On Mon, Sep 3, 2018 at 6:31 PM, Wes Turner wrote: > > > On Mon, Sep 3, 2018 at 4:17 AM Chris Angelico wrote: >> >> On Mon, Sep 3, 2018 at 5:23 PM, Jacco van Dorp >> wrote: >> > This feels really useful to me to make some quick changes to a database >> > - >> > perhaps a database layer could

Re: [Python-ideas] Add recordlcass to collections module

2018-09-03 Thread Wes Turner
On Mon, Sep 3, 2018 at 4:17 AM Chris Angelico wrote: > On Mon, Sep 3, 2018 at 5:23 PM, Jacco van Dorp > wrote: > > This feels really useful to me to make some quick changes to a database - > > perhaps a database layer could return an class of type Recordclass, and > then > > you just simply

Re: [Python-ideas] Add recordlcass to collections module

2018-09-03 Thread Chris Angelico
On Mon, Sep 3, 2018 at 5:23 PM, Jacco van Dorp wrote: > This feels really useful to me to make some quick changes to a database - > perhaps a database layer could return an class of type Recordclass, and then > you just simply mutate it and shove it back into the database. Pseudocode: > > record

Re: [Python-ideas] Add recordlcass to collections module

2018-09-03 Thread Wes Turner
On Mon, Sep 3, 2018 at 3:25 AM Jacco van Dorp wrote: > This feels really useful to me to make some quick changes to a database - > perhaps a database layer could return an class of type Recordclass, and > then you just simply mutate it and shove it back into the database. > Pseudocode: > >

Re: [Python-ideas] Add recordlcass to collections module

2018-09-03 Thread Jonathan Goble
On Mon, Sep 3, 2018 at 3:25 AM Jacco van Dorp wrote: > Also, it's rather clear that namedList is a really bad name for a > Recordclass. It's cleary not intended to be a list. It's a record you can > take out from somewhere, mutate, and push back in. > So call it "namedrecord", perhaps?

Re: [Python-ideas] Add recordlcass to collections module

2018-09-03 Thread Jacco van Dorp
This feels really useful to me to make some quick changes to a database - perhaps a database layer could return an class of type Recordclass, and then you just simply mutate it and shove it back into the database. Pseudocode: record = database.execute("SELECT * FROM mytable WHERE primary_key =

Re: [Python-ideas] Add recordlcass to collections module

2018-09-02 Thread Steven D'Aprano
On Sun, Sep 02, 2018 at 10:56:50PM +0200, Martin Bammer wrote: > Compared to dataclass: > dataclass wins only on the topic object size. When it comes to speed and > functionality (indexing, sorting) dataclass would be my last choice. I see no sign that recordclass supports sorting. (But I admit

Re: [Python-ideas] Add recordlcass to collections module

2018-09-02 Thread Greg Ewing
Zaur Shibzukhov wrote: > `Recordclass` is defined on top of` memoryslots` just like `namedtuple` > above` tuple`. Attributes are accessed via a descriptor (`itemgetset`), > which supports both` __get__` and `__set__` by the element index. > > As a result, `recordclass` takes up as much memory

Re: [Python-ideas] Add recordlcass to collections module

2018-09-02 Thread Wes Turner
On Sunday, September 2, 2018, Zaur Shibzukhov wrote: > > > --- > *Zaur Shibzukhov* > > > 2018-09-02 22:11 GMT+03:00 Wes Turner : > >> Does the value of __hash__ change when attributes of a recordclass change? >> > > Currently recordclass's __hash__ didn't implemented. >

Re: [Python-ideas] Add recordlcass to collections module

2018-09-02 Thread Martin Bammer
Hi, then intention of my first mail was to start a discussion about this topic about the pros and cons and possible alternatives. As long as it is not clear that recordclass or something like that is accepted to be implemented to the collections module I do not want to spend any effort on

Re: [Python-ideas] Add recordlcass to collections module

2018-09-02 Thread Zaur Shibzukhov
As the author of `recordclass` I would like to shed some light... Recorclass originated as a response to the [question](https://stackoverflow.com/questions/29290359/existence-of-mutable-named-tuple-in-python/29419745#29419745) on stackoverflow. `Recordclass` was conceived and implemented as a

Re: [Python-ideas] Add recordlcass to collections module

2018-09-01 Thread Steven D'Aprano
On Sat, Sep 01, 2018 at 05:10:49PM +0100, Jonathan Fine wrote: > Hi Martin > > Summary: Thank you. Your suggestion has good points. I suggest to > advance it (i) provide a pure Python implementation of namedlist, and > (ii) ask that the Python docs for namedtuple provide a link to > namedlist.

Re: [Python-ideas] Add recordlcass to collections module

2018-09-01 Thread Thautwarm Zhao
> > > -- Forwarded message -- > From: Martin Bammer > To: python-ideas@python.org > Cc: > Bcc: > Date: Sat, 1 Sep 2018 09:47:04 +0200 > Subject: [Python-ideas] Add recordlcass to collections module > Hi, > > what about adding recordclass

Re: [Python-ideas] Add recordlcass to collections module

2018-09-01 Thread Jonathan Goble
On Sat, Sep 1, 2018 at 1:38 PM Robert Vanden Eynde wrote: > What's the difference between you proposition and dataclasses ? Introduced > in Python 3.7 ? > A named list would allow sequence operations such as iteration. Dataclasses, IIUC, do not support sequence operations.

Re: [Python-ideas] Add recordlcass to collections module

2018-09-01 Thread Robert Vanden Eynde
What's the difference between you proposition and dataclasses ? Introduced in Python 3.7 ? Le sam. 1 sept. 2018 à 19:33, Jonathan Goble a écrit : > On Sat, Sep 1, 2018 at 1:08 PM Angus Hollands wrote: > >> As to the other questions, yes, do we need another module in the standard >> library? >>

Re: [Python-ideas] Add recordlcass to collections module

2018-09-01 Thread Jonathan Goble
On Sat, Sep 1, 2018 at 1:08 PM Angus Hollands wrote: > As to the other questions, yes, do we need another module in the standard > library? > Wouldn't need a new module. This would be a perfect fit for the existing collections module where namedtuple already resides. I Googled "pypi

Re: [Python-ideas] Add recordlcass to collections module

2018-09-01 Thread Angus Hollands
> > From: "Steven D'Aprano" > To: python-ideas@python.org > Cc: > Bcc: > Date: Sat, 1 Sep 2018 18:25:21 +1000 > Subject: Re: [Python-ideas] Add recordlcass to collections module > On Sat, Sep 01, 2018 at 09:47:04AM +0200, Martin Bammer wrote: > > H

Re: [Python-ideas] Add recordlcass to collections module

2018-09-01 Thread Jonathan Fine
Hi Martin Summary: Thank you. Your suggestion has good points. I suggest to advance it (i) provide a pure Python implementation of namedlist, and (ii) ask that the Python docs for namedtuple provide a link to namedlist. Thank you, Martin, for bringing

Re: [Python-ideas] Add recordlcass to collections module

2018-09-01 Thread Steven D'Aprano
On Sat, Sep 01, 2018 at 09:47:04AM +0200, Martin Bammer wrote: > Hi, > > what about adding recordclass > (https://bitbucket.org/intellimath/recordclass) to the collections module The first thing you need to do is ask the author of that library whether or not he or she is willing to donate the

[Python-ideas] Add recordlcass to collections module

2018-09-01 Thread Martin Bammer
Hi, what about adding recordclass (https://bitbucket.org/intellimath/recordclass) to the collections module It is like namedtuple, but elements are writable and it is written in C and thus much faster. And for convenience it could be named as namedlist. Regards, Martin