Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.
This repository was archived by the owner on May 29, 2026. It is now read-only.

Support formatting-preserving insertion into collections #80

Description

@soupytwist

Original report:

########## Example 1: insert the "'b':'b_s'" into dict D by alphabet order
D = {
    'a': 'a_s',
               # <-----------------------------------'b': 'b_s'
    'c': 'c_s',
}

# expected output:
D = {
    'a': 'a_s',
    'b': 'b_s',
    'c': 'c_s',
}

# output actually got:
D = {
    'a': 'a_s',
    'b': 'b_s', 'c': 'c_s',
}

########## Example 2: insert the "'y':'y_s'" into dict D by alphabet order
D = {
    'a': 'a_s',
    'c': 'c_s',
                   # <-----------------------------------'y': 'y_s'
}

# expected output:
D = {
    'a': 'a_s',
    'c': 'c_s',
    'y': 'y_s',
}

# output actually got:
D = {
    'a': 'a_s',
    'c': 'c_s', 'y': 'y_s',
}

Notes:
This should be supported by a collection_insert (or similar) function, taking the collection node (e.g. a Dict), the node (or nodes) to insert, and the index to insert at. This should result in consistent formatting as described above.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions