Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-10 Thread Guido van Rossum
OTOH daytaclass is a decorator for *better* metaclass compatibility. On Dec 10, 2017 13:17, "Antoine Pitrou" wrote: > On Sun, 10 Dec 2017 20:47:45 +0100 > Antoine Pitrou wrote: > > > Hi, > > > > On Sun, 10 Dec 2017 19:17:25 + > > Tin Tvrtković

Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-10 Thread Antoine Pitrou
On Sun, 10 Dec 2017 20:47:45 +0100 Antoine Pitrou wrote: > Hi, > > On Sun, 10 Dec 2017 19:17:25 + > Tin Tvrtković wrote: > > Hello, > > > > I'm one of the attrs contributors, and the person who initially wrote the > > slots functionality there. >

Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-10 Thread Antoine Pitrou
Hi, On Sun, 10 Dec 2017 19:17:25 + Tin Tvrtković wrote: > Hello, > > I'm one of the attrs contributors, and the person who initially wrote the > slots functionality there. > > We've given up on returning a new class always since this can conflict with > certain

Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-10 Thread Tin Tvrtković
development on this front. :) Date: Sat, 9 Dec 2017 08:52:15 -0500 > From: "Eric V. Smith" <e...@trueblade.com> > To: Nathaniel Smith <n...@pobox.com> > Cc: Python Dev <python-dev@python.org> > Subject: Re: [Python-Dev] Issues with PEP 526 Variable Notation a

Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-09 Thread Nick Coghlan
On 9 December 2017 at 12:14, Nathaniel Smith wrote: > You'd have to ask Hynek to get the full rationale, but I believe it was both > for consistency with slot classes, and for consistency with regular class > definition. For example, type.__new__ actually does different things >

Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-09 Thread Aaron Hall via Python-Dev
I'm not a typing expert, but I want to second Raymond's concerns, and perhaps I'm qualified to do so as I gave the PyCon USA __slots__ talk this year and I have a highly voted answer describing them on Stack Overflow. Beautiful thing we're doing here with the dataclasses, by the way. I think

Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-09 Thread Ivan Levkivskyi
On 8 December 2017 at 19:28, Raymond Hettinger wrote: > > I'm hoping the typing experts will chime in here. The question is > straight-forward. Where should we look for the signature and docstring for > constructing instances? Should they be attached to the class,

Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-09 Thread Eric V. Smith
On 12/8/2017 9:14 PM, Nathaniel Smith wrote: On Dec 7, 2017 12:49, "Eric V. Smith" > wrote: The reason I didn't include it (as @dataclass(slots=True)) is because it has to return a new class, and the rest of the dataclass features just

Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-08 Thread Nathaniel Smith
On Dec 7, 2017 12:49, "Eric V. Smith" wrote: The reason I didn't include it (as @dataclass(slots=True)) is because it has to return a new class, and the rest of the dataclass features just modifies the given class in place. I wanted to maintain that conceptual simplicity. But

Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-08 Thread Guido van Rossum
On Fri, Dec 8, 2017 at 3:44 PM, Eric V. Smith wrote: > On 12/8/2017 1:28 PM, Raymond Hettinger wrote: > >> >> >> On Dec 7, 2017, at 12:47 PM, Eric V. Smith wrote: >>> >>> On 12/7/17 3:27 PM, Raymond Hettinger wrote: >>> ... >>> >>> I'm looking for

Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-08 Thread Eric V. Smith
On 12/8/2017 1:28 PM, Raymond Hettinger wrote: On Dec 7, 2017, at 12:47 PM, Eric V. Smith wrote: On 12/7/17 3:27 PM, Raymond Hettinger wrote: ... I'm looking for guidance or workarounds for two issues that have arisen. First, the use of default values seems to

Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-08 Thread Raymond Hettinger
> On Dec 7, 2017, at 12:47 PM, Eric V. Smith wrote: > > On 12/7/17 3:27 PM, Raymond Hettinger wrote: > ... > >> I'm looking for guidance or workarounds for two issues that have arisen. >> >> First, the use of default values seems to completely preclude the use of >>

Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-08 Thread Guido van Rossum
Yes, I think this is a reasonable argument for adding a 'slots' option (off by default) for @dataclass(). However I don't think we need to rush it in. I'm not very happy with the general idea of slots any more, and I think that it's probably being overused, and at the same time I expect that there

Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-07 Thread Eric V. Smith
On 12/7/17 3:27 PM, Raymond Hettinger wrote: ... I'm looking for guidance or workarounds for two issues that have arisen. First, the use of default values seems to completely preclude the use of __slots__. For example, this raises a ValueError: class A: __slots__ = ['x', 'y']