New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dataclasses.replace() fails with the field named "obj" #81344
Comments
>>> from dataclasses import *
>>> @dataclass
... class D:
... obj: object
...
>>> replace(D(123), obj='abc')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: replace() got multiple values for argument 'obj' |
Possibly a use for positional-only parameters. Backward compatibility is the question, of course. |
I propose to add a deprecation warning in 3.8 and use the PEP-570 syntax in 3.9 (which means a TypeError if obj is passed by keyword argument). |
+1 for Serhiy's suggestion |
+1 to Serhiy's proposal |
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: