File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -160,10 +160,16 @@ The :mod:`functools` module defines the following functions:
160160 grow without bound.
161161
162162 If *typed * is set to true, function arguments of different types will be
163- cached separately. For example, ``f(3) `` and ``f(3.0) `` will always be
164- treated as distinct calls with distinct results. If *typed * is false,
165- the implementation will usually but not always regard them as equivalent
166- calls and only cache a single result.
163+ cached separately. If *typed * is false, the implementation will usually
164+ regard them as equivalent calls and only cache a single result. (Some
165+ types such as *str * and *int * may be cached separately even when *typed *
166+ is false.)
167+
168+ Note, type specificity applies only to the function's immediate arguments
169+ rather than their contents. The scalar arguments, ``Decimal(42) `` and
170+ ``Fraction(42) `` are be treated as distinct calls with distinct results.
171+ In contrast, the tuple arguments ``('answer', Decimal(42)) `` and
172+ ``('answer', Fraction(42)) `` are treated as equivalent.
167173
168174 The wrapped function is instrumented with a :func: `cache_parameters `
169175 function that returns a new :class: `dict ` showing the values for *maxsize *
You can’t perform that action at this time.
0 commit comments