From 6f49e877ce555d870ff3aa48e0891fff52e4a6f5 Mon Sep 17 00:00:00 2001 From: noahhaasis Date: Wed, 13 Jun 2018 13:56:32 +0200 Subject: [PATCH] bpo-33836: Fix code example in the documentation. --- Doc/faq/programming.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst index d986ab642bfb32..53f3b7f528c065 100644 --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -371,8 +371,8 @@ compute, a common technique is to cache the parameters and the resulting value of each call to the function, and return the cached value if the same value is requested again. This is called "memoizing", and can be implemented like this:: - # Callers will never provide a third parameter for this function. - def expensive(arg1, arg2, _cache={}): + # Callers can only provide two parameters and optionally pass _cache by keyword + def expensive(arg1, arg2, *, _cache={}): if (arg1, arg2) in _cache: return _cache[(arg1, arg2)]