Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support formatting-preserving insertion into collections #80

Open
soupytwist opened this issue Dec 6, 2019 · 0 comments
Open

Support formatting-preserving insertion into collections #80

soupytwist opened this issue Dec 6, 2019 · 0 comments
Assignees

Comments

@soupytwist
Copy link
Collaborator

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.

@soupytwist soupytwist self-assigned this Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant