[issue36077] Inheritance dataclasses fields and default init statement

2021-04-29 Thread Eric V. Smith
Eric V. Smith added the comment: I'm going to close this in favor of the kw_only work done in issue 43532. I realize they're not quite the same thing, but we'll see how it works out in Python 3.10, and possibly make adjustments when we have some real world experience. --

[issue36077] Inheritance dataclasses fields and default init statement

2020-05-06 Thread Laurie Opperman
Laurie Opperman added the comment: Daniel's suggestion (and my PR) introduce a mechanism that is as far as I know almost completely bakwards-compatible. The only issue is if people were wanting (and acting on) a TypeError to be raised on dataclass construction (which I would say is rare to

[issue36077] Inheritance dataclasses fields and default init statement

2020-05-06 Thread Eric V. Smith
Eric V. Smith added the comment: It would be good if there were some way of unifying existing usage with positional-only and keyword-only parameters, and also supporting inheritance for dataclasses that use these features at various points in the hierarchy. I don't have any big ideas about

[issue36077] Inheritance dataclasses fields and default init statement

2019-12-05 Thread Martijn Pieters
Martijn Pieters added the comment: I've supported people hitting this issue before (see https://stackoverflow.com/a/53085935/100297, where I used a series of mixin classes to make use of the changing MRO when the mixins share base classes, to enforce a field order from inherited classes.

[issue36077] Inheritance dataclasses fields and default init statement

2019-11-21 Thread Laurie Opperman
Laurie Opperman added the comment: I've added a PR implementing Daniel L's suggestion -- nosy: +Epic_Wink versions: +Python 3.6 -Python 3.7, Python 3.8 ___ Python tracker ___

[issue36077] Inheritance dataclasses fields and default init statement

2019-11-21 Thread Laurie Opperman
Change by Laurie Opperman : -- keywords: +patch pull_requests: +16808 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17322 ___ Python tracker ___

[issue36077] Inheritance dataclasses fields and default init statement

2019-08-13 Thread Kim Gustyr
Change by Kim Gustyr : -- nosy: +kgustyr ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36077] Inheritance dataclasses fields and default init statement

2019-08-02 Thread Daniel Lepage
Daniel Lepage added the comment: A simpler way to merge them would be to make all arguments after a default argument keyword-only, e.g. __index__(self, i, j=0, *, k, l=0) It does mean you'd have to explicitly write e.g. Child(1, k=4), but that's a lot more readable than seeing Child(1, 4)

[issue36077] Inheritance dataclasses fields and default init statement

2019-02-22 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: I see your point. On the other hand, a new parameter would also increase the complexity for the user. Maybe it should not be seen as re-ordering but just a "zipping" them correctly: @dataclass class Parent: i: int j: int = 0 @dataclass class

[issue36077] Inheritance dataclasses fields and default init statement

2019-02-22 Thread Eric V. Smith
Eric V. Smith added the comment: I'm not keen on re-ordering parameters. Maybe it could be done if specified with a parameter to @dataclass. -- ___ Python tracker ___

[issue36077] Inheritance dataclasses fields and default init statement

2019-02-22 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: I think this is what is referring Кирилл Чуркин to: Python 3.7.2 (default, Jan 13 2019, 12:50:01) [Clang 10.0.0 (clang-1000.11.45.5)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from dataclasses import dataclass >>>

[issue36077] Inheritance dataclasses fields and default init statement

2019-02-22 Thread Eric V. Smith
Change by Eric V. Smith : -- assignee: -> eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36077] Inheritance dataclasses fields and default init statement

2019-02-22 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Can you please add a simple reproducer to understand the issue in little more detail? I could see some tests along with different cases producing the error message at

[issue36077] Inheritance dataclasses fields and default init statement

2019-02-22 Thread SilentGhost
Change by SilentGhost : -- nosy: +eric.smith versions: +Python 3.8 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue36077] Inheritance dataclasses fields and default init statement

2019-02-22 Thread Кирилл Чуркин
New submission from Кирилл Чуркин : I found a problem when use inherit dataclasses. When I define parent dataclass with field(s) with default (or default_factory) properties, and inherit child dataclass from parent, i define non-default field in it and got `TypeError('non-default argument