Skip to content

Commit e2856ea

Browse files
committed
add sentence
1 parent b432877 commit e2856ea

File tree

3 files changed

+34
-32
lines changed

3 files changed

+34
-32
lines changed

decorator.md

+14-13
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ __Result:__
187187
>> type(say_miau) : <class '__main__.CountCalls'>
188188
>> say_miau.__name__ : say_miau
189189
>> say_miau.__doc__ : docstring: print the vocalization of a Felis Catus, also known as cat
190-
>> say_miau.__wrapped__ : <function say_miau at 0x7f9eacde6a60>
190+
>> say_miau.__wrapped__ : <function say_miau at 0x7f93e95e7a60>
191191
```
192192

193193
Attention!
@@ -340,7 +340,7 @@ for idx in range(1, 4):
340340
__Result:__
341341

342342
```
343-
>> LimitCalls function: <function square_me at 0x7f9eacde94c0> max_hits: 3 log_calls: False
343+
>> LimitCalls function: <function square_me at 0x7f93e95eb4c0> max_hits: 3 log_calls: False
344344
>> square_me type: <class '__main__._LimitCalls'>
345345
>> idx: 1
346346
>> call # 1 returns: 4
@@ -446,7 +446,7 @@ __Result:__
446446
>> LimitCalls function: None max_hits: 1 log_calls: True
447447
>> Calling: Foo #call: 1 positional-arguments: keyword-arguments:
448448
>> inside Foo.__init__
449-
>> Return from: Foo #call: 1 return-value: <__main__.Foo object at 0x7f9eacdec460>
449+
>> Return from: Foo #call: 1 return-value: <__main__.Foo object at 0x7f93e95ec460>
450450
>> do_something in Foo
451451
```
452452

@@ -576,8 +576,8 @@ for idx in range(1, 5):
576576
__Result:__
577577

578578
```
579-
>> LimitCalls2 _func: <function dec_three_from_me at 0x7f9eacdf3310> max_hits: 3 Log_calls: False
580-
>> LimitCalls in nested forward_func_call. func: <function dec_three_from_me at 0x7f9eacdf3310>
579+
>> LimitCalls2 _func: <function dec_three_from_me at 0x7f93e95f3310> max_hits: 3 Log_calls: False
580+
>> LimitCalls in nested forward_func_call. func: <function dec_three_from_me at 0x7f93e95f3310>
581581
>> type(dec_three_from_me) : <class 'function'>
582582
>> dec_three_from_me.__name__ : dec_three_from_me
583583
>> dec_three_from_me.__doc__ : None
@@ -621,7 +621,7 @@ __Result:__
621621

622622
```
623623
>> LimitCalls2 _func: None max_hits: 2 Log_calls: True
624-
>> LimitCalls in nested forward_func_call. func: <function dec_me at 0x7f9eacdf3940>
624+
>> LimitCalls in nested forward_func_call. func: <function dec_me at 0x7f93e95f3940>
625625
>> idx: 1
626626
>> Calling: dec_me #call: 1 positional-arguments: 1 keyword-arguments:
627627
>> Return from: dec_me #call: 1 return-value: 0
@@ -662,7 +662,7 @@ __Result:__
662662
>> LimitCalls in nested forward_func_call. func: <class '__main__.Foo3'>
663663
>> Calling: Foo3 #call: 1 positional-arguments: keyword-arguments:
664664
>> inside Foo3.__init__
665-
>> Return from: Foo3 #call: 1 return-value: <__main__.Foo3 object at 0x7f9eacdf5070>
665+
>> Return from: Foo3 #call: 1 return-value: <__main__.Foo3 object at 0x7f93e95f5070>
666666
>> do_something in Foo3
667667
```
668668

@@ -693,9 +693,9 @@ __Result:__
693693

694694
```
695695
>> LimitCalls2 _func: None max_hits: 3 Log_calls: True
696-
>> LimitCalls in nested forward_func_call. func: <function Foo4.do_something at 0x7f9eacdf4700>
696+
>> LimitCalls in nested forward_func_call. func: <function Foo4.do_something at 0x7f93e95f4700>
697697
>> inside Foo4.__init__
698-
>> Calling: do_something #call: 1 positional-arguments: <__main__.Foo4 object at 0x7f9eacde5ac0> keyword-arguments:
698+
>> Calling: do_something #call: 1 positional-arguments: <__main__.Foo4 object at 0x7f93e95e5ac0> keyword-arguments:
699699
>> do_something in Foo4
700700
>> Return from: do_something #call: 1 return-value: None
701701
```
@@ -749,8 +749,8 @@ __Result:__
749749

750750
```
751751
>> absolute of a number: 3
752-
>> 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
754754
```
755755

756756
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.
@@ -788,7 +788,7 @@ print("color red: ", colour_red , "red:", colour_red.red , "green:", colour_red.
788788
__Result:__
789789

790790
```
791-
>> color red: <__main__.Colour object at 0x7f9eacdfafa0> red: 255 green: 0 blue: 0
791+
>> color red: <__main__.Colour object at 0x7f93e95fafa0> red: 255 green: 0 blue: 0
792792
```
793793

794794
At first it doesn't make an awfull lot of sense, but lets derive the ColourWithAlphaChannel class from Colour
@@ -819,7 +819,7 @@ print("color red: ", colour_red , "red:", colour_red.red , "green:", colour_red.
819819
__Result:__
820820

821821
```
822-
>> 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
823823
```
824824

825825

@@ -923,6 +923,7 @@ Here you get your trade offs...
923923

924924
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.
925925
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!
926927

927928

928929
__Source:__

decorator.py

+1
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ def fib(arg_num):
639639
print_md("""
640640
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.
641641
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!
642643
""")
643644

644645
eval_and_quote("""

0 commit comments

Comments
 (0)