You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>> random number between 0 and 1 0.39104524345933955
753
-
>> random number between 0 and 1 0.7975686849823579
752
+
>> random number between 0 and 1 0.5480016164493293
753
+
>> random number between 0 and 1 0.02929297165088285
754
754
```
755
755
756
756
A method that is declared with the @classmthod decorator, here the first parameter is the class object. Note that a method like this doesn't have a self parameter.
>> color red: <__main__.ColourWithAlphaChannel object at 0x7f9eacdf5790> red: 255 green: 0 blue: 0 alpha: 1.0
822
+
>> color red: <__main__.ColourWithAlphaChannel object at 0x7f93e95f5790> red: 255 green: 0 blue: 0 alpha: 1.0
823
823
```
824
824
825
825
@@ -923,6 +923,7 @@ Here you get your trade offs...
923
923
924
924
There is also a least recently used cache [@functools.lru\_cache](https://docs.python.org/3/library/functools.html#functools.lru\_cache), of limited size.
925
925
Note that you get the same number of cache hits for the bounded cache, on the fibonacci function (author is scratching his head)
926
+
This happens, of course, as only the last two results are needed for the fibonacci sequence!
Copy file name to clipboardexpand all lines: decorator.py
+1
Original file line number
Diff line number
Diff line change
@@ -639,6 +639,7 @@ def fib(arg_num):
639
639
print_md("""
640
640
There is also a least recently used cache [@functools.lru_cache](https://docs.python.org/3/library/functools.html#functools.lru_cache), of limited size.
641
641
Note that you get the same number of cache hits for the bounded cache, on the fibonacci function (author is scratching his head)
642
+
This happens, of course, as only the last two results are needed for the fibonacci sequence!
0 commit comments