Skip to content

Make dict() work like it does in cpython #236

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

Merged
merged 3 commits into from
Dec 22, 2018

Conversation

coolreader18
Copy link
Member

e.g.

dict(a=2, b=3) == {'a': 2, 'b': 3}
dict({'a': 2, 'b': 3}, b=4) == {'a': 2, 'b': 4}
dict([('a', 2), ('b', 3)]) == {'a': 2, 'b': 3}

@windelbouwman
Copy link
Contributor

Nice!

required = [(_ty, Some(vm.ctx.type_type()))],
optional = [(dict_obj, None)]
);
let dict = vm.ctx.new_dict();
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, we could potentially use _ty to support dict subclasses as well.

@windelbouwman windelbouwman merged commit 366f3e2 into RustPython:master Dec 22, 2018
@coolreader18 coolreader18 deleted the proper-dict branch December 22, 2018 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants