Thanks for this post! I noticed that itemgetter("x")(dict(x=10, y=20)) would return a single element (10), while itemgetter("x", "y")(dict(x=10, y=20)) returns a tuple. Do you happen to know a way to streamline this and force it to always return the same type (i.e. a tuple)?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for this post! I noticed that
itemgetter("x")(dict(x=10, y=20))
would return a single element (10), whileitemgetter("x", "y")(dict(x=10, y=20))
returns a tuple. Do you happen to know a way to streamline this and force it to always return the same type (i.e. a tuple)?