{"action":"created","issue":{"url":"https://api.github.com/repos/robotframework/robotframework/issues/1913","labels_url":"https://api.github.com/repos/robotframework/robotframework/issues/1913/labels{/name}","comments_url":"https://api.github.com/repos/robotframework/robotframework/issues/1913/comments","events_url":"https://api.github.com/repos/robotframework/robotframework/issues/1913/events","html_url":"https://github.com/robotframework/robotframework/issues/1913","id":57018633,"number":1913,"title":"Move `Create Dictionary` to BuiltIn and enhance to preserve order, allow accessing keys as attributes, etc.","user":{"login":"pekkaklarck","id":114985,"avatar_url":"https://avatars.githubusercontent.com/u/114985?v=3","gravatar_id":"","url":"https://api.github.com/users/pekkaklarck","html_url":"https://github.com/pekkaklarck","followers_url":"https://api.github.com/users/pekkaklarck/followers","following_url":"https://api.github.com/users/pekkaklarck/following{/other_user}","gists_url":"https://api.github.com/users/pekkaklarck/gists{/gist_id}","starred_url":"https://api.github.com/users/pekkaklarck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pekkaklarck/subscriptions","organizations_url":"https://api.github.com/users/pekkaklarck/orgs","repos_url":"https://api.github.com/users/pekkaklarck/repos","events_url":"https://api.github.com/users/pekkaklarck/events{/privacy}","received_events_url":"https://api.github.com/users/pekkaklarck/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/robotframework/robotframework/labels/alpha%201","name":"alpha 1","color":"ffffff"},{"url":"https://api.github.com/repos/robotframework/robotframework/labels/bwic","name":"bwic","color":"fbca04"},{"url":"https://api.github.com/repos/robotframework/robotframework/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/robotframework/robotframework/labels/prio-medium","name":"prio-medium","color":"ededed"}],"state":"closed","locked":false,"assignee":{"login":"pekkaklarck","id":114985,"avatar_url":"https://avatars.githubusercontent.com/u/114985?v=3","gravatar_id":"","url":"https://api.github.com/users/pekkaklarck","html_url":"https://github.com/pekkaklarck","followers_url":"https://api.github.com/users/pekkaklarck/followers","following_url":"https://api.github.com/users/pekkaklarck/following{/other_user}","gists_url":"https://api.github.com/users/pekkaklarck/gists{/gist_id}","starred_url":"https://api.github.com/users/pekkaklarck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pekkaklarck/subscriptions","organizations_url":"https://api.github.com/users/pekkaklarck/orgs","repos_url":"https://api.github.com/users/pekkaklarck/repos","events_url":"https://api.github.com/users/pekkaklarck/events{/privacy}","received_events_url":"https://api.github.com/users/pekkaklarck/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/robotframework/robotframework/milestones/16","html_url":"https://github.com/robotframework/robotframework/milestones/2.9","labels_url":"https://api.github.com/repos/robotframework/robotframework/milestones/16/labels","id":705012,"number":16,"title":"2.9","description":null,"creator":{"login":"spooning","id":1658993,"avatar_url":"https://avatars.githubusercontent.com/u/1658993?v=3","gravatar_id":"","url":"https://api.github.com/users/spooning","html_url":"https://github.com/spooning","followers_url":"https://api.github.com/users/spooning/followers","following_url":"https://api.github.com/users/spooning/following{/other_user}","gists_url":"https://api.github.com/users/spooning/gists{/gist_id}","starred_url":"https://api.github.com/users/spooning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spooning/subscriptions","organizations_url":"https://api.github.com/users/spooning/orgs","repos_url":"https://api.github.com/users/spooning/repos","events_url":"https://api.github.com/users/spooning/events{/privacy}","received_events_url":"https://api.github.com/users/spooning/received_events","type":"User","site_admin":false},"open_issues":24,"closed_issues":39,"state":"open","created_at":"2014-06-29T21:43:00Z","updated_at":"2015-04-10T07:05:25Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-02-09T11:26:51Z","updated_at":"2015-04-10T15:54:26Z","closed_at":"2015-02-10T11:28:07Z","body":"RF 2.9 will have new dictionary variable type (#1450) making dictionaries much more useful and thus also most likely much more used in RF test data. It thus makes sense to move `Create Dictionary` keyword from Collections to BuiltIn to have it always available. Notice that we already have `Create List` in BuiltIn.\r\n\r\n`Create Dictionary` should also be enhanced to allow creating dictionaries similarly as `&{dicts}` are created in variable table. This includes:\r\n\r\n- Making returned dictionary dot-accessible (e.g. `${dict.key}`).\r\n- Making returned dictionary ordered.\r\n- Preserving order of given items.\r\n- Allow non-strings in keys when using `key=value` syntax.\r\n\r\nThe last two points mean that we cannot use `**kwargs` in signature because they are not ordered and cannot contain non-string keys. Accepting just `*items` in format `key=value` and parsing them using same logic (and same code) that parses variable table values ought to be easy, though. After that we probably should deprecate the currently supported functionality to give keys and values separately like `| Create Dictionary | key1 | value1 | key2 | value 2 |`.\r\n\r\nThis change is not fully backwards compatible, but we don't expect these issues to consider too much problems:\r\n\r\n- Using the keyword like `Collections.Create Dictionary` won't work anymore. Just dropping the library name ought to be enough as a fix.\r\n- Returned dictionary won't be \"normal\" Python `dict` but its subclass. Shouldn't matter in real life, but we can add keyword like `Create Normal Dictionary` to Collections if needed.\r\n- Giving keys and values separately will be depracated. Using `key=value` syntax works (except for non-string keys) already in RF 2.8, so this shouldn't be a problem. If giving keys and values separately turns out to be an actually useful feature, we can consider keeping it and removing deprecation."},"comment":{"url":"https://api.github.com/repos/robotframework/robotframework/issues/comments/91599279","html_url":"https://github.com/robotframework/robotframework/issues/1913#issuecomment-91599279","issue_url":"https://api.github.com/repos/robotframework/robotframework/issues/1913","id":91599279,"user":{"login":"pekkaklarck","id":114985,"avatar_url":"https://avatars.githubusercontent.com/u/114985?v=3","gravatar_id":"","url":"https://api.github.com/users/pekkaklarck","html_url":"https://github.com/pekkaklarck","followers_url":"https://api.github.com/users/pekkaklarck/followers","following_url":"https://api.github.com/users/pekkaklarck/following{/other_user}","gists_url":"https://api.github.com/users/pekkaklarck/gists{/gist_id}","starred_url":"https://api.github.com/users/pekkaklarck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pekkaklarck/subscriptions","organizations_url":"https://api.github.com/users/pekkaklarck/orgs","repos_url":"https://api.github.com/users/pekkaklarck/repos","events_url":"https://api.github.com/users/pekkaklarck/events{/privacy}","received_events_url":"https://api.github.com/users/pekkaklarck/received_events","type":"User","site_admin":false},"created_at":"2015-04-10T15:54:26Z","updated_at":"2015-04-10T15:54:26Z","body":"@boakley, could you submit a separate issue about yaml variable files? Sounds pretty good on the first thought.\r\n\r\nDo others also prefer giving dict keys and values separately like `key | value` and not like `key=value`? The latter is same syntax as when creating dict vars in the variable table, but keeping also the former isn't a problem if it is found useful."}}