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

added items, to_object and zip functions to specification #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jstewmon
Copy link

@bosr
Copy link

bosr commented Apr 2, 2016

👍 yesss!

@shashankmehra
Copy link

Given [["one", 1], ["two", 2], ["one", 3]] what should be the output of from_items(@)?
Possible candidates could be: {"one": 1, "two": 2} or {"one": 3, "two": 2} or {"one": [1,3], "two": 2}

@jstewmon
Copy link
Author

@shashankmehra the last pair for any key will win, so in your example, the result will be:
{"one": 3, "two": 2}.

This is consistent with _.fromPairs in JavaScript:

> _.fromPairs([["one", 1], ["two", 2], ["one", 3]])
{ one: 3, two: 2 }

And dict construction in python:

>>> dict([["one", 1], ["two", 2], ["one", 3]])
{'two': 2, 'one': 3}

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.

Let us select dict values by criteria on their associated keys
3 participants