funcy icon indicating copy to clipboard operation
funcy copied to clipboard

group by docs

Open iloveitaly opened this issue 1 year ago • 1 comments

This wasn't easy for me to figure out from the docs.

Curious: any interest in allowing a string to be passed to group_by as the function? i.e.

group_by("age", [{"age": 10, "name": "Alice"}])

if the seq elements are a dictionary, "age" could be automatically converted into an itemgetter. Feels more intuitive to me.

iloveitaly avatar Feb 20 '24 18:02 iloveitaly

group_by() already transforms various non-callables including string to functions, i.e. string is transformed as regex match, see https://funcy.readthedocs.io/en/stable/extended_fns.html

While I support examples in docs the ones here feel too verbose and extra tests excessive.

Suor avatar Feb 20 '24 23:02 Suor