[issue44190] Dictionary assignment shorthand

2021-05-21 Thread Terry J. Reedy
Change by Terry J. Reedy : -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue44190] Dictionary assignment shorthand

2021-05-20 Thread Christian Heimes
Christian Heimes added the comment: Your proposal is not possible in Python. The object does not know under which variable names it is accessible. The closest you can get is this: >>> dict( ... foo="bar" ... ) {'foo': 'bar'} -- nosy: +christian.heimes

[issue44190] Dictionary assignment shorthand

2021-05-20 Thread David Hariri
New submission from David Hariri : In some languages, one may declare a dictionary's key and its value like so: ``` foo = "bar" my_dict = { foo } >> { "foo" : "bar" } ``` In Python, one must instead write: ``` foo = "bar" my_dict = { "foo": foo } >> { "foo" : "bar" } ``` I humbly