Add compile-time support for dict.values#2661
Conversation
|
@kmr-srbh whenever something works with |
I am posting the output. 👍 |
% cat examples/expr2.py
print({1: "a"}.values())
% python examples/expr2.py
dict_values(['a'])
% lpython examples/expr2.py
['a']
% cat examples/expr2.py
print({1: "a"}.values()[0])
% python examples/expr2.py
Traceback (most recent call last):
File "/Users/ubaid/Desktop/OpenSource/lpython/examples/expr2.py", line 1, in <module>
print({1: "a"}.values()[0])
TypeError: 'dict_values' object is not subscriptable
% lpython examples/expr2.py
aIt seems technically a |
|
Please mark as "Ready for review" when ready. |
22b719f to
d524180
Compare
|
@certik do you have views on #2661 (comment)? This PR returns |
|
@Shaikh-Ubaid I return a list for |
Thanks for sharing. It makes sense. |
|
@Shaikh-Ubaid the conflicts have been resolved. |
* Implement `dict.values` for `DictConstant` * Tests: Add tests * Tests: Fix typing mistake * Tests: Update references * Uncomment check for modifying attribute * Tests: Update references * Delete tests/reference/asr-func_04-eef2656.stdout * Tests: Move `print` before `assert` * Tests: Update test
* Implement `dict.values` for `DictConstant` * Tests: Add tests * Tests: Fix typing mistake * Tests: Update references * Uncomment check for modifying attribute * Tests: Update references * Delete tests/reference/asr-func_04-eef2656.stdout * Tests: Move `print` before `assert` * Tests: Update test
Working
CPython
LPython