DEV Community

Discussion on: The Unknown Features of Python's Operator Module

Collapse
 
xtofl profile image
xtofl

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)?