Title: Add support for `dict` methods with `Const` by kmr-srbh · Pull Request #2567 · lcompilers/lpython · GitHub
Open Graph Title: Add support for `dict` methods with `Const` by kmr-srbh · Pull Request #2567 · lcompilers/lpython
X Title: Add support for `dict` methods with `Const` by kmr-srbh · Pull Request #2567 · lcompilers/lpython
Description: Fixes #2585 Support for following attributes was implemented: dict.get - fetches the required value dict.pop - throws a SemanticError stating that changes cannot be made to a const dict dict.keys - fetches the list of keys dict.values - fetches the list of values get() d: Const[dict[str, i32]] = {"a": 1, "b": 2, "c": 3} print(d.get("a")) (base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py 1 pop() d: Const[dict[str, i32]] = {"a": 1, "b": 2, "c": 3} print(d.pop("a")) (base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py semantic error: cannot pop elements from a const dict --> ./examples/example.py:8:7 | 8 | print(d.pop("a")) | ^^^^^^^^^^ Note: Please report unclear or confusing messages as bugs at https://github.com/lcompilers/lpython/issues. keys() d: Const[dict[str, i32]] = {"a": 1, "b": 2, "c": 3} print(d.keys()) (base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py ['c', 'a', 'b'] values() d: Const[dict[str, i32]] = {"a": 1, "b": 2, "c": 3} print(d.values()) (base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py [3, 1, 2]
Open Graph Description: Fixes #2585 Support for following attributes was implemented: dict.get - fetches the required value dict.pop - throws a SemanticError stating that changes cannot be made to a const dict dict.keys ...
X Description: Fixes #2585 Support for following attributes was implemented: dict.get - fetches the required value dict.pop - throws a SemanticError stating that changes cannot be made to a const dict dict.keys ...
Opengraph URL: https://github.com/lcompilers/lpython/pull/2567
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:5c830ea1-5e1c-9dde-6b76-71a75d155d55 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | BC4A:1DC6:1C73BC9:2676959:6992F0E4 |
| html-safe-nonce | 8a69d3545dd6dd476230f232b6b806d47f18df724889c70588fe6a28721c7028 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzRBOjFEQzY6MUM3M0JDOToyNjc2OTU5OjY5OTJGMEU0IiwidmlzaXRvcl9pZCI6IjUzOTQ3MDY1MTE1NjkyODUzNDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9e3ed77054bbc3e33ace855c6a0ec3087a3edb579b2bbccc2eb28df68093fc04 |
| hovercard-subject-tag | pull_request:1753054866 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/lcompilers/lpython/pull/2567/checks |
| twitter:image | https://avatars.githubusercontent.com/u/151380951?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/151380951?s=400&v=4 |
| og:image:alt | Fixes #2585 Support for following attributes was implemented: dict.get - fetches the required value dict.pop - throws a SemanticError stating that changes cannot be made to a const dict dict.keys ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 01ab16879a3159e6f0717ab948b9b562e162a6aafd1f4393b786b07b747df244 |
| turbo-cache-control | no-preview |
| go-import | github.com/lcompilers/lpython git https://github.com/lcompilers/lpython.git |
| octolytics-dimension-user_id | 96538276 |
| octolytics-dimension-user_login | lcompilers |
| octolytics-dimension-repository_id | 442864346 |
| octolytics-dimension-repository_nwo | lcompilers/lpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 442864346 |
| octolytics-dimension-repository_network_root_nwo | lcompilers/lpython |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b1570f3928bef80fa5fc7890ce0942e9b696ad9d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width