Closed ericvsmith closed 3 years ago
Any chance for an upcoming release for the kw_only
backport? I find this a really useful feature for dataclasses
.
@Minitour : But then you couldn't write code that worked in 3.6 and 3.7. Is that really desirable? I'm not sure I want take on a backport under a different name that could be used in 3.6, 3.7, ..., 3.10. It seems unending. Maybe it's best to just say that this backport is 3.7 compatible and leave it at that.
I am currently working on a project heavily written in 3.6 and we find the use of kw_only
highly beneficial.
This will allow us to inherit from classes that have default properties and not explicitly declare defaults for the fields of the sub-classes.
We have encountered many solutions out there to try and deal with the issue, but kw_only
seems the most suitable one.
What would you do if you upgraded to 3.7, where dataclasses doesn't have this feature?
The problem is that "import dataclasses" in 3.7 will use the stdlib version of dataclasses, which does not have kw_only.
This could be solved by changing this repo's code to be "dataclasses2", or something. But I don't really want to try and support a bunch of old python versions.
But I feel your pain: I'm also working on a large 3.6 code base.
I now understand the dilemma. Yes you are right at this point it will become a backport from the latest python version (3.10) to 3.6. Which will put 3.6 projects at an "advantage" where 3.7 projects will need a backport of its own.
In my opinion, this library is made specifically for 3.6 and you should not concern yourself with what happens with 3.7+, but to simply align with the latest specs of dataclasses
. But that is my personal biased opinion.
In my opinion, this library is made specifically for 3.6 and you should not concern yourself with what happens with 3.7+, but to simply align with the latest specs of
dataclasses
. But that is my personal biased opinion.
I don't think it's fair that the backport would set them up into a situation where the users cannot update to 3.7.
I'm going to reject this.
I'm personally stuck on python 3.6 at a client's site, so I think I'll backport these. On the other hand, when that client moves to 3.7 it will break my code, so maybe it's not the best idea in the world. This issue is just to remind me about it.