You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting from an empty dict, I might make assignments like this:
glom.assign({}, "a.0.b", "value", missing=?)
The result I expect is the following:
{ 'a': [ { 'b': 'value' } ] }
although I understand that it could also be interpreted as
{ 'a': { '0': { 'b': 'value' } } }
This means that I want the missing function to create a list for the missing structure "a", and a dict for the missing structure "a.0".
Unfortunately, missing isn't called with any arguments that would allow me to return a list or a dict depending on whether the next path part is an int or a string.
Is there some other way to do what I want?
The text was updated successfully, but these errors were encountered:
foucdeg
changed the title
when assigning, how to ggenerate a different missing structure based on path type?
When assigning, how to generate a different missing structure based on path type?
Jul 26, 2021
Here to bump this issue and check if any progress has been made on this? Otherwise is there another way we can assign between lists and dicts on current version?
@Kwill3 we haven't really done anything with this. I think everyone's open to the idea, though.
I guess the next step in the conversation is to ask what arguments would be useful? We could pass the current path, the current glom scope (possibly too technical for day-to-day use), just the name of the current field, etc.?
Starting from an empty dict, I might make assignments like this:
The result I expect is the following:
although I understand that it could also be interpreted as
This means that I want the
missing
function to create a list for the missing structure "a", and a dict for the missing structure "a.0".Unfortunately,
missing
isn't called with any arguments that would allow me to return a list or a dict depending on whether the next path part is an int or a string.Is there some other way to do what I want?
The text was updated successfully, but these errors were encountered: