Skip to content
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

Extend dict update to accept keyword args #7684

Closed
wants to merge 2 commits into from
Closed

Extend dict update to accept keyword args #7684

wants to merge 2 commits into from

Conversation

Quarz0
Copy link
Contributor

@Quarz0 Quarz0 commented Mar 10, 2019

Closes dict.update should return None, not self #18

dict.update() method should now accept keyword args just like dict(...)

Example of usage:

>> a = dict(a=1)
..
>> a.update(b=2)
..
None
>> a.update({'c': 3})
..
None
>> a
..
{"a": 1, "b": 2, "c": 3}

@laurentlb
Copy link
Contributor

Thanks for the pull request!
Are there tests for this?

@brandjon, can you look at this PR? Both Chris and I are on leave this week.

@Quarz0
Copy link
Contributor Author

Quarz0 commented Mar 14, 2019

I added some tests

@brandjon
Copy link
Member

Roger, will review later today.

src/test/starlark/testdata/dict.sky Show resolved Hide resolved
src/test/starlark/testdata/dict.sky Show resolved Hide resolved
src/test/starlark/testdata/dict.sky Show resolved Hide resolved
src/test/starlark/testdata/dict.sky Show resolved Hide resolved
Copy link
Contributor

@laurentlb laurentlb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks

If there's no more issue, I'm going to import this change.

@brandjon
Copy link
Member

Approved, though I suggested one additional assertion for the unit test for Laurent to add as we're importing.

@bazel-io bazel-io closed this in b37296c Mar 18, 2019
@laurentlb
Copy link
Contributor

fyi, I added a few more tests here: 4d65f44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants