Transcrypt icon indicating copy to clipboard operation
Transcrypt copied to clipboard

dict constructor does not support keyword arguments

Open faerot opened this issue 5 years ago • 1 comments

It does not allow dict(a=1, b=2) which I can live without, but it also does not allow dict(a, b=2) and dict(a, **b) which is unfortunate.

faerot avatar Mar 24 '20 17:03 faerot

All of the following work:

# python
a = dict(a=1, b=2)
b = dict(a, b=2)
c = dict(a, **{"b": 2})
// js output
// import {...}
var __name__ = '__main__';
export var a = dict (__kwargtrans__ ({a: 1, b: 2}));
export var b = dict (a, __kwargtrans__ ({b: 2}));
export var c = dict (a, __kwargtrans__ (dict ({'b': 2})));

Tested in chromium console

AlexECX avatar May 13 '20 13:05 AlexECX