An object can define an inverse by defining a pow(self, exponent) method
that returns something besides NotImplemented when given the exponent -1.
The inverse of iterables is by default defined to be the iterable's items,
each inverted, in reverse order.
Args
val
The value (or iterable of invertible values) to invert.
default
Determines the fallback behavior when val doesn't have
an inverse defined. If default is not set, a TypeError is raised.
If default is set to a value, that value is returned.
Returns
If val has a pow method that returns something besides
NotImplemented when given an exponent of -1, that result is returned.
Otherwise, if val is iterable, the result is a tuple with the same
items as val but in reverse order and with each item inverted.
Otherwise, if a default argument was specified, it is returned.
Raises
TypeError
val doesn't have a pow method, or that method returned
NotImplemented when given -1. Furthermore val isn't an
iterable containing invertible items. Also, no default argument
was specified.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-10-08 UTC."],[],[]]