X Tutup
The Wayback Machine - https://web.archive.org/web/20250615043952/https://github.com/python/cpython/issues/92668
Skip to content

Dictionary shorthand #92668

Closed
Closed
@PositiveUser

Description

@PositiveUser

Feature or enhancement

I want a shorthand for dictionaries


Code for a configuration:

{
    'flavours': {
        'chocolate': {
            'type': 'dark'
        }
    }
}

This will be long. Below is my idea. You can use this idea or make your own shorthand syntax:

{
    'flavours'['chocolate']['type']: 'dark'
}
# Is same as
{
    'flavours': {
        'chocolate': {
            'type': 'dark'
        }
    }
}

Another example:

{
    'flavours': {
        'chocolate'['type']: 'dark',
        'apple'['type']: 'red',
    }
}
# Is same as
{
    'flavours': {
        'chocolate': {
            'type': 'dark'
        },
        'apple'{
            'type': 'red'
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup