[issue38444] dataclass: always generate default __init__ on __default_init__

2019-10-11 Thread Eric V. Smith
Eric V. Smith added the comment: Thanks. I'm always looking for ways to make dataclasses easier to use, while keeping within the original goals. I'll close this for now. -- resolution: -> wont fix stage: -> resolved status: open -> closed ___

[issue38444] dataclass: always generate default __init__ on __default_init__

2019-10-11 Thread Shmuel H.
Shmuel H. added the comment: The only other solution I could think about was to change setattr's behaviour dynamically so that it would be valid to call it from frozen instance's `__init__`, but I think it is somehow even worst. However, thanks for your help, I think we can close this one

[issue38444] dataclass: always generate default __init__ on __default_init__

2019-10-11 Thread Eric V. Smith
Eric V. Smith added the comment: I'll try and think of something better. I know I'm guilty of sending to python-ideas all the time, but discussing proposed design decisions like this are what that list is all about. If you want to bring it up there, I'd focus on making the problem

[issue38444] dataclass: always generate default __init__ on __default_init__

2019-10-11 Thread Shmuel H.
Shmuel H. added the comment: I think it was designed to. However, it is not very usable in production for a number of reasons: 1. It won't work with frozen instances (you'll have to call `object.__setattr__` directly). 2. It gets very messy with more than one or two `InitVar`s which makes it

[issue38444] dataclass: always generate default __init__ on __default_init__

2019-10-11 Thread Eric V. Smith
Eric V. Smith added the comment: Doesn't __post_init__ address this use case? -- ___ Python tracker ___ ___ Python-bugs-list

[issue38444] dataclass: always generate default __init__ on __default_init__

2019-10-11 Thread Eric V. Smith
Eric V. Smith added the comment: This would be a 3.9 feature only, so changing the versions. -- versions: -Python 3.7, Python 3.8 ___ Python tracker ___

[issue38444] dataclass: always generate default __init__ on __default_init__

2019-10-11 Thread Eric V. Smith
Change by Eric V. Smith : -- assignee: -> eric.smith nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue38444] dataclass: always generate default __init__ on __default_init__

2019-10-11 Thread Shmuel H.
New submission from Shmuel H. : Currently, `dataclasses.dataclass` will generate `__init__` only where the user has not defined one. However, sometimes, with frozen classes or dataclasses with a lot of members, redefinition of this function is not trivial, especially if the only purpose is