Kurt Rose
Kurt Rose
That last one works, but is quite awkward... ```python >>> target = [{'id': 0}, {'id': 1}] >>> from glom import glom, T, Call >>> from glom.core import Spec >>> glom(target,...
I'll get back to work on `Check`; honestly, if all you want to do is filter a single-level list like that, I think you're better off with a list comprehension...
better dict literal syntax might help ```python glom(target, ({T['id']: T}, T[0])) ```
The intention of `Record` is to generate a tuple of items, akin to the list-of-tuples returned by `fetchall()` in dbapi2 database APIs (e.g. sqlite3 in the standard library). Some other...
in pattern matching there is the notion of a "guard expression" (came across it here https://www.reddit.com/r/Python/comments/725xam/adding_pattern_matching_to_python/dngkgde/) ```python extract(x) if guard: ... ``` `Guard` is another alternative for `Check` perhaps name-wise
We've got a lot more parts to play with over the last two years: ```python ([Or(M(T.id) == pk, default=SKIP)], T[0]) ``` Hmm not sure if that is any clearer
this is close, but doesn't quite work right: ```python Iter().first('user.client', default=None) ``` ```python >>> t3 = [{'b': 1}, {'a': 2}] >>> glom(t3, Iter('a').first()) Traceback (most recent call last): File "",...
maybe this could be addressed by `'*'` paths -- `Coalesce('*.user.client', default=None)` instead of `[Coalesce('user.client', default=SKIP)]`
right? :-) I think `Iter()` does some weird things inside its eval
