[Python-Dev] What is the design purpose of metaclasses vs code generating decorators? (was Re: PEP 557: Data Classes)

2017-10-12 Thread Nick Coghlan
On 13 October 2017 at 04:21, Martin Teichmann wrote: > For me, the dataclasses were a typical example for inheritance, to be > more precise, for metaclasses. I was astonished to see them > implemented using decorators, and I was not the only one, citing > Guido: > > > I think it would be useful t

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Raymond Hettinger
> On Oct 12, 2017, at 7:46 AM, Guido van Rossum wrote: > > I am still firmly convinced that @dataclass is the right name for the > decorator (and `dataclasses` for the module). +1 from me. The singular/plural pair has the same nice feel as "from fractions import Fraction", "from itertools im

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Ethan Furman
On 10/12/2017 03:44 PM, Chris Barker wrote: I think we've drifted into a new topic, but... I was thinking about this last spring, when I tried to cram all sorts of python metaprogramming into one 3hr class... Trying to come up with a an exam[ple for metclasses, I couldn't come up with anyth

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Eric V. Smith
On 10/12/2017 6:33 PM, Chris Barker wrote: On Thu, Oct 12, 2017 at 3:20 AM, Steve Holden > wrote:  The reason I liked "row" as a name is because it resembles "vector" and hence is loosely assocaited with the concept of a tuple as well as being familiar

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Chris Barker
I think we've drifted into a new topic, but... I was astonished to see them > implemented using decorators, and I was not the only one. ... > Python is at a weird point here. At about every new release of Python, > a new idea shows up that could be easily solved using metaclasses, yet > ever

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Chris Barker
On Thu, Oct 12, 2017 at 3:20 AM, Steve Holden wrote: > The reason I liked "row" as a name is because it resembles "vector" and > hence is loosely assocaited with the concept of a tuple as well as being > familiar to database users. In fact the answer to a relational query was, I > believe, ori

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Guido van Rossum
You're right that if it were easier to combine metaclasses we would not shy away from them so easily. Perhaps you and others interested in this topic can try to prototype an implementation and see how it would work in practice (with some realistic existing metaclasses)? Then the next step would be

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Martin Teichmann
Hi list, first, a big thanks to the authors of PEP 557! Great idea! For me, the dataclasses were a typical example for inheritance, to be more precise, for metaclasses. I was astonished to see them implemented using decorators, and I was not the only one, citing Guido: > I think it would be usef

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Mike Miller
On 2017-10-11 23:05, Nick Coghlan wrote: It's akin to "static method", "class method", and "instance method" for function definitions (although the last one isn't a typical decorator, since it's the default behaviour for functions placed inside a class). Thanks, I'm still thinking of it as i

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Stéfane Fermigier
On Thu, Oct 12, 2017 at 10:20 AM, Mike Miller wrote: > > On 2017-10-12 00:36, Stéfane Fermigier wrote: > >> "An object that is not defined by its attributes, but rather by a thread >> of continuity and its identity." (from https://en.wikipedia.org/wiki/ >> Domain-driven_design#Building_blocks) >>

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Stéfane Fermigier
On Wed, Oct 11, 2017 at 10:33 PM, Mike Miller wrote: > (Apologies for reviving a dead horse, but may not be around at the blessed > time.) > > As potential names of this concept, I liked record and row, but agreed > they were a bit too specific and not quite exact. In my recent (unrelated) > rea

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Barry Warsaw
On Oct 12, 2017, at 10:46, Guido van Rossum wrote: > > I am still firmly convinced that @dataclass is the right name for the > decorator (and `dataclasses` for the module). Darn, and I was going to suggest they be called EricTheHalfABees, with enums being renamed to EricTheHalfNotBees. -Barry

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Guido van Rossum
I am still firmly convinced that @dataclass is the right name for the decorator (and `dataclasses` for the module). -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/pyth

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Gustavo Carneiro
On 12 October 2017 at 11:20, Steve Holden wrote: > On Thu, Oct 12, 2017 at 9:20 AM, Mike Miller > wrote: > >> >> On 2017-10-12 00:36, Stéfane Fermigier wrote: >> >>> "An object that is not defined by its attributes, but rather by a thread >>> of continuity and its identity." (from https://en.wik

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Steve Holden
On Thu, Oct 12, 2017 at 9:20 AM, Mike Miller wrote: > > On 2017-10-12 00:36, Stéfane Fermigier wrote: > >> "An object that is not defined by its attributes, but rather by a thread >> of continuity and its identity." (from https://en.wikipedia.org/wiki/ >> Domain-driven_design#Building_blocks) >>

Re: [Python-Dev] PEP 557: Data Classes

2017-10-12 Thread Mike Miller
On 2017-10-12 00:36, Stéfane Fermigier wrote: "An object that is not defined by its attributes, but rather by a thread of continuity and its identity." (from https://en.wikipedia.org/wiki/Domain-driven_design#Building_blocks) Not sure I follow all this, but Python objects do have identities o