Open foucdeg opened 3 years ago
that's a great suggestion, providing arguments to missing
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.?
A really cool thing would be to create one's own spec type (forked from Assign) and experiment, if you'd like to help advance the feature. Docs on spec type creation are here: https://glom.readthedocs.io/en/latest/custom_spec_types.html
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?