diff options
Diffstat (limited to 'blog/conseq.md')
-rw-r--r-- | blog/conseq.md | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/blog/conseq.md b/blog/conseq.md index 5b843eb..b9ea570 100644 --- a/blog/conseq.md +++ b/blog/conseq.md @@ -65,17 +65,17 @@ but since we will only evaluate the first few terms 8 ``` -@@note -The `fibo_seq` above is just to demonstrate how `itertools.count` -can be use to create an infinite sequence defined by a function. -For better performance, this should be used instead: +!!! note "Note" -```python -def fibonacci_sequence(a=0, b=1): - yield a - yield from fibonacci_sequence(b, a + b) -``` -@@ + The `fibo_seq` above is just to demonstrate how `itertools.count` + can be use to create an infinite sequence defined by a function. + For better performance, the following should be used instead: + + ```python + def fibonacci_sequence(a=0, b=1): + yield a + yield from fibonacci_sequence(b, a+b) + ``` It is noticable that the elements having been iterated through (using `next`) will disappear forever in the void (oh no!), but that is the cost we are |