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] Fix some special cases in Fractions?

2018-09-01 Thread Jonathan Fine
Greg Ewing and Jonathan Goble wrote >> Also, Fraction(1) for the second case would be flat-out wrong. > How? Raising something to the 2/3 power means squaring it and then taking > the cube root of it. -1 squared is 1, and the cube root of 1 is 1. Or am I > having a 2:30am brain fart? Let's see.

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: > > Hi, > > > > what about adding recordclass > >

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

Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-09-01 Thread Stefan Behnel
Matthew Einhorn schrieb am 31.08.2018 um 20:57: > with model: > with Dense(): > units = 64 > activation = 'relu' > input_dim = 100 > > with Dense(): > units = 10 > activation = 'softmax' This looks like it could use 'class' instead of 'with'.

[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