-
Notifications
You must be signed in to change notification settings - Fork 277
feat: support __replace__ for Version
#1003
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
Conversation
__replace__ for Version
|
I'm not against using Also, I don't understand how to best call it across all Python versions that don't support it, e.g. in #999 would I directly call Finally, does the fact the API is related to copy imply it must return a copy even if no attributes have changed? |
It's a standard API, so someone reading
Sure. I mostly wanted tests to verify
I'm nearly sure the answer is no, if an object is immutable (which It does imply that the original object is not modified. |
|
I think I can clean this up a bit, and I want to see if I can get the no-copy feature back in, so putting it in draft for a bit. I need some sort of performance test too. |
Co-authored-by: Damian Shaw <[email protected]> Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
6863f73 to
eab10c1
Compare
|
Okay, I've restored the "no copy if unchanged" feature, and cleaned it up. |
notatallshaw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Alternative to #998, using
__replace__. I've also dropped the matching instance if unchanged feature, since it's building up the instance as it goes, so it wouldn't really save much.Assuming it looks good,
I think we shouldn't exposeEdit, done..replace, and just rely on.__replace__, haven't changed the tests to that though.