On Sep 8, 2017, at 8:52 AM, Paul Moore <[email protected]> wrote:
On 8 September 2017 at 15:57, Eric V. Smith <[email protected]> wrote:
I've written a PEP for what might be thought of as "mutable namedtuples with
defaults, but not inheriting tuple's behavior" (a mouthful, but it sounded
simpler when I first thought of it). It's heavily influenced by the attrs
project. It uses PEP 526 type annotations to define fields.
[...]
The PEP is largely complete, but could use some filling out in places.
Comments welcome!
Eric.
P.S. I wrote this PEP when I was in my happy place.
Looks good! One minor point - apparently in your happy place, C and
Python have the same syntax :-)
"""
field's may optionally specify a default value, using normal Python syntax:
@dataclass
class C:
int a # 'a' has no default value
int b = 0 # assign a default value for 'b'
"""