problem with del dict['key']
Problem with del dict['key'] using __pragma__('opov')
The del dict['key'] statement works with no pragma, but dictionary key is not removed using __pragma__('opov') or transcrypt -o option. In addition, del dict['key'] using __pragma__('opov') causes a parse error with code minification. The dict.pop('key') method does not have an issue.
test1.py:
d = {'a': 1, 'b': 2, 'c': 3}
del d['c']
print(d)
transcrypt -n test1.pyoutput: {'a': 1, 'b': 2}
test2.py:
__pragma__('opov')
d = {'a': 1, 'b': 2, 'c': 3}
del d['c']
print(d)
transcrypt -n test2.pyoutput: {'a': 1, 'b': 2, 'c': 3}
transcrypt test2.py(with minification) Parse error. Invalid delete operand. Only properties can be deleted. delete getitem (d, 'c');
Environment: Linux Python 3.9.6 Transcrypt 3.9.0 Chrome/Firefox
Had similar problem with del dict['key'] not working using __pragma__('keycheck') or -kc option. The dict.pop('key') method can be used instead, which is unaffected by either __pragma__('opov') or __pragma__('keycheck').