diff --git a/README.md b/README.md index 3651c2b..b960f78 100644 --- a/README.md +++ b/README.md @@ -217,8 +217,7 @@ from itertools import count, repeat, cycle, chain, islice Generator --------- -* **Convenient way to implement the iterator protocol.** -* **Any function that contains a yield statement returns a generator object.** +* **Any function that contains a yield statement returns a generator.** * **Generators and iterators are interchangeable.** ```python diff --git a/index.html b/index.html index 37f823a..127e038 100644 --- a/index.html +++ b/index.html @@ -357,8 +357,7 @@ to_exclusive = <range>.stop <iter> = islice(<collection>, from_inclusive, to_exclusive, +step_size)

#Generator

def count(start, step):
     while True:
@@ -879,7 +878,7 @@ creature  = Creature(Point(0, @lru_cache(maxsize=None)
 def fib(n):
-    return n if n < 2 else fib(n-2) + fib(n-1)
+    return n if n < 2 else fib(n-2) + fib(n-1)
 
diff --git a/parse.js b/parse.js index 19fe932..9b666c2 100755 --- a/parse.js +++ b/parse.js @@ -208,6 +208,12 @@ const EVAL = '>>> literal_eval(\'abs(1)\')\n' + 'ValueError: malformed node or string\n'; +const LRU_CACHE = + 'from functools import lru_cache\n' + + '\n' + + '@lru_cache(maxsize=None)\n' + + 'def fib(n):\n' + + ' return n if n < 2 else fib(n-2) + fib(n-1)\n'; function main() { const html = getMd(); @@ -307,6 +313,7 @@ function fixClasses() { function fixHighlights() { $(`code:contains(os.rename)`).html(OS_RENAME); $(`code:contains(ValueError: malformed node)`).html(EVAL); + $(`code:contains(@lru_cache(maxsize=None))`).html(LRU_CACHE); } function preventPageBreaks() {