[New-bugs-announce] [issue44190] Dictionary assignment shorthand

David Hariri report at bugs.python.org
Thu May 20 10:40:20 EDT 2021


New submission from David Hariri <david.hariri at gmail.com>:

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 suggest this change as a QoL improvement for those who work with dictionaries all day.

----------
messages: 394027
nosy: davidhariri
priority: normal
severity: normal
status: open
title: Dictionary assignment shorthand
type: enhancement

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44190>
_______________________________________


More information about the New-bugs-announce mailing list