@@ -197,7 +197,7 @@ __Result:__
197
197
>> type(say_miau) : <class '__main__.CountCalls'>
198
198
>> say_miau.__name__ : say_miau
199
199
>> say_miau.__doc__ : docstring: print the vocalization of a Felis Catus, also known as cat
200
- >> say_miau.__wrapped__ : <function say_miau at 0x7fe31470a280 >
200
+ >> say_miau.__wrapped__ : <function say_miau at 0x7fe50c802310 >
201
201
```
202
202
203
203
Attention!
@@ -350,7 +350,7 @@ for idx in range(1, 4):
350
350
__ Result:__
351
351
352
352
```
353
- >> LimitCalls function: <function square_me at 0x7fe31470f670 > max_hits: 3 log_calls: False
353
+ >> LimitCalls function: <function square_me at 0x7fe50c804790 > max_hits: 3 log_calls: False
354
354
>> square_me type: <class '__main__._LimitCalls'>
355
355
>> idx: 1
356
356
>> call # 1 returns: 4
@@ -380,7 +380,7 @@ __Result:__
380
380
381
381
```
382
382
>> LimitCalls function: None max_hits: 4 log_calls: True
383
- >> wrapper function: <function cube_me at 0x7fe31470fc10 >
383
+ >> wrapper function: <function cube_me at 0x7fe50c804d30 >
384
384
```
385
385
386
386
cube\_ me is a variable of type \_ LimitCalls
@@ -457,7 +457,7 @@ __Result:__
457
457
>> wrapper function: <class '__main__.Foo'>
458
458
>> Calling: Foo #call: 1 positional-arguments: keyword-arguments:
459
459
>> inside Foo.__init__
460
- >> Return from: Foo #call: 1 return-value: <__main__.Foo object at 0x7fe314713100 >
460
+ >> Return from: Foo #call: 1 return-value: <__main__.Foo object at 0x7fe50c809160 >
461
461
>> do_something in Foo
462
462
```
463
463
@@ -627,8 +627,8 @@ for idx in range(1, 5):
627
627
__ Result:__
628
628
629
629
```
630
- >> LimitCalls2 _func: <function dec_three_from_me at 0x7fe314714af0 > max_hits: 3 Log_calls: False
631
- >> LimitCalls in nested forward_func_call. func: <function dec_three_from_me at 0x7fe314714af0 >
630
+ >> LimitCalls2 _func: <function dec_three_from_me at 0x7fe50c80ac10 > max_hits: 3 Log_calls: False
631
+ >> LimitCalls in nested forward_func_call. func: <function dec_three_from_me at 0x7fe50c80ac10 >
632
632
>> type(dec_three_from_me) : <class 'function'>
633
633
>> dec_three_from_me.__name__ : dec_three_from_me
634
634
>> dec_three_from_me.__doc__ : None
@@ -673,7 +673,7 @@ __Result:__
673
673
674
674
```
675
675
>> LimitCalls2 _func: None max_hits: 2 Log_calls: True
676
- >> LimitCalls in nested forward_func_call. func: <function dec_me at 0x7fe31471b160 >
676
+ >> LimitCalls in nested forward_func_call. func: <function dec_me at 0x7fe50c807280 >
677
677
>> idx: 1
678
678
>> Calling: dec_me #call: 1 positional-arguments: 1 keyword-arguments:
679
679
>> Return from: dec_me #call: 1 return-value: 0
@@ -714,7 +714,7 @@ __Result:__
714
714
>> LimitCalls in nested forward_func_call. func: <class '__main__.Foo3'>
715
715
>> Calling: Foo3 #call: 1 positional-arguments: keyword-arguments:
716
716
>> inside Foo3.__init__
717
- >> Return from: Foo3 #call: 1 return-value: <__main__.Foo3 object at 0x7fe314719310 >
717
+ >> Return from: Foo3 #call: 1 return-value: <__main__.Foo3 object at 0x7fe50c8102b0 >
718
718
>> do_something in Foo3
719
719
```
720
720
@@ -745,9 +745,9 @@ __Result:__
745
745
746
746
```
747
747
>> LimitCalls2 _func: None max_hits: 3 Log_calls: True
748
- >> LimitCalls in nested forward_func_call. func: <function Foo4.do_something at 0x7fe31471bee0 >
748
+ >> LimitCalls in nested forward_func_call. func: <function Foo4.do_something at 0x7fe50c816040 >
749
749
>> inside Foo4.__init__
750
- >> Calling: do_something #call: 1 positional-arguments: <__main__.Foo4 object at 0x7fe3147198b0 > keyword-arguments:
750
+ >> Calling: do_something #call: 1 positional-arguments: <__main__.Foo4 object at 0x7fe50c810850 > keyword-arguments:
751
751
>> do_something in Foo4
752
752
>> Return from: do_something #call: 1 return-value: None
753
753
```
@@ -801,8 +801,8 @@ __Result:__
801
801
802
802
```
803
803
>> absolute of a number: 3
804
- >> random number between 0 and 1 0.007452044931850588
805
- >> random number between 0 and 1 0.9842930421729486
804
+ >> random number between 0 and 1 0.25110412114316527
805
+ >> random number between 0 and 1 0.28173332825716046
806
806
```
807
807
808
808
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.
@@ -840,7 +840,7 @@ print("color red: ", colour_red , "red:", colour_red.red , "green:", colour_red.
840
840
__ Result:__
841
841
842
842
```
843
- >> color red: <__main__.Colour object at 0x7fe31472bfa0 > red: 255 green: 0 blue: 0
843
+ >> color red: <__main__.Colour object at 0x7fe50c823e50 > red: 255 green: 0 blue: 0
844
844
```
845
845
846
846
At first it doesn't make an awfull lot of sense, but lets derive the ColourWithAlphaChannel class from Colour.
@@ -874,7 +874,7 @@ print("color red: ", colour_red , "red:", colour_red.red , "green:", colour_red.
874
874
__ Result:__
875
875
876
876
```
877
- >> color red: <__main__.ColourWithAlphaChannel object at 0x7fe314713bb0 > red: 255 green: 0 blue: 0 alpha: 1.0
877
+ >> color red: <__main__.ColourWithAlphaChannel object at 0x7fe50c8107c0 > red: 255 green: 0 blue: 0 alpha: 1.0
878
878
```
879
879
880
880
Other examples of alternate constructors in the standard library:
0 commit comments