New submission from Barry A. Warsaw <ba...@python.org>:

In reading over the new dataclasses documentation, I'm unsure what the `init` 
flag is used for, given that:

* If you already have a __init__(), then dataclasses won't add one
* If you don't have a __init__(), why wouldn't you want dataclasses to add one? 
 Without that, how do your attributes get initialized?

If there is a valid use case for `init`, I'm happy to add it to the 
documentation.  If there isn't, can we call YAGNI and remove the flag?

I'm mildly of the same opinion with `repr` but I can see some value in wanting 
to defer to object.__repr__().  OTOH, it should be pretty easy to just write:

@dataclass
class Foo:
    def __repr__(self):
        return super.__repr__()

----------
assignee: eric.smith
messages: 316812
nosy: barry, eric.smith, gvanrossum
priority: normal
severity: normal
status: open
title: Remove `init` flag from @dataclass?
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33539>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to