mahmoud / glom

☄️ Python's nested data operator (and CLI), for all your declarative restructuring needs. Got data? Glom it! ☄️
https://glom.readthedocs.io
Other
1.89k stars 61 forks source link

WIP: Implicit chaining in lists: Make [x, y,...] same as [(x, y, ...)] #221

Open mathrick opened 3 years ago

mathrick commented 3 years ago

Fixes #220

There are currently multiple test failures because of #107. I think this demonstrates that the current handling of SKIP is not optimal, since I would definitely expect glom(target, spec) == glom(target, (spec,)).

kurtbrose commented 2 years ago

oh hey sorry for letting this get stale :-) the reason for SKIP having weird behavior is that tuple intercepts SKIP

https://github.com/mahmoud/glom/blob/master/glom/core.py#L1861-L1862

the tuple "hides" SKIP from the enclosing list

I'm surprised this doesn't cause some kind of infinite loop, since it causes _handle_tuple to defer over to Pipe, which itself calls back to _handle_tuple: https://github.com/mahmoud/glom/blob/master/glom/core.py#L1885