@@ -188,7 +188,7 @@ __Result:__
188
188
>> type(say_miau) : <class '__main__.CountCalls'>
189
189
>> say_miau.__name__ : say_miau
190
190
>> say_miau.__doc__ : docstring: print the vocalization of a Felis Catus, also known as cat
191
- >> say_miau.__wrapped__ : <function say_miau at 0x7f865fde8a60 >
191
+ >> say_miau.__wrapped__ : <function say_miau at 0x7fc95e4d4a60 >
192
192
```
193
193
194
194
Attention!
@@ -341,7 +341,7 @@ for idx in range(1, 4):
341
341
__ Result:__
342
342
343
343
```
344
- >> LimitCalls function: <function square_me at 0x7f865fdee4c0 > max_hits: 3 log_calls: False
344
+ >> LimitCalls function: <function square_me at 0x7fc95e4da4c0 > max_hits: 3 log_calls: False
345
345
>> square_me type: <class '__main__._LimitCalls'>
346
346
>> idx: 1
347
347
>> call # 1 returns: 4
@@ -447,7 +447,7 @@ __Result:__
447
447
>> LimitCalls function: None max_hits: 1 log_calls: True
448
448
>> Calling: Foo #call: 1 positional-arguments: keyword-arguments:
449
449
>> inside Foo.__init__
450
- >> Return from: Foo #call: 1 return-value: <__main__.Foo object at 0x7f865fde55b0 >
450
+ >> Return from: Foo #call: 1 return-value: <__main__.Foo object at 0x7fc95e4d15b0 >
451
451
>> do_something in Foo
452
452
```
453
453
@@ -614,8 +614,8 @@ for idx in range(1, 5):
614
614
__ Result:__
615
615
616
616
```
617
- >> LimitCalls2 _func: <function dec_three_from_me at 0x7f865fdf4940 > max_hits: 3 Log_calls: False
618
- >> LimitCalls in nested forward_func_call. func: <function dec_three_from_me at 0x7f865fdf4940 >
617
+ >> LimitCalls2 _func: <function dec_three_from_me at 0x7fc95e4e0940 > max_hits: 3 Log_calls: False
618
+ >> LimitCalls in nested forward_func_call. func: <function dec_three_from_me at 0x7fc95e4e0940 >
619
619
>> type(dec_three_from_me) : <class 'function'>
620
620
>> dec_three_from_me.__name__ : dec_three_from_me
621
621
>> dec_three_from_me.__doc__ : None
@@ -659,7 +659,7 @@ __Result:__
659
659
660
660
```
661
661
>> LimitCalls2 _func: None max_hits: 2 Log_calls: True
662
- >> LimitCalls in nested forward_func_call. func: <function dec_me at 0x7f865fdf4f70 >
662
+ >> LimitCalls in nested forward_func_call. func: <function dec_me at 0x7fc95e4e0f70 >
663
663
>> idx: 1
664
664
>> Calling: dec_me #call: 1 positional-arguments: 1 keyword-arguments:
665
665
>> Return from: dec_me #call: 1 return-value: 0
@@ -700,7 +700,7 @@ __Result:__
700
700
>> LimitCalls in nested forward_func_call. func: <class '__main__.Foo3'>
701
701
>> Calling: Foo3 #call: 1 positional-arguments: keyword-arguments:
702
702
>> inside Foo3.__init__
703
- >> Return from: Foo3 #call: 1 return-value: <__main__.Foo3 object at 0x7f865fdf6b50 >
703
+ >> Return from: Foo3 #call: 1 return-value: <__main__.Foo3 object at 0x7fc95e4e1b50 >
704
704
>> do_something in Foo3
705
705
```
706
706
@@ -731,9 +731,9 @@ __Result:__
731
731
732
732
```
733
733
>> LimitCalls2 _func: None max_hits: 3 Log_calls: True
734
- >> LimitCalls in nested forward_func_call. func: <function Foo4.do_something at 0x7f865fdf4d30 >
734
+ >> LimitCalls in nested forward_func_call. func: <function Foo4.do_something at 0x7fc95e4e0d30 >
735
735
>> inside Foo4.__init__
736
- >> Calling: do_something #call: 1 positional-arguments: <__main__.Foo4 object at 0x7f865fd26970 > keyword-arguments:
736
+ >> Calling: do_something #call: 1 positional-arguments: <__main__.Foo4 object at 0x7fc95e426970 > keyword-arguments:
737
737
>> do_something in Foo4
738
738
>> Return from: do_something #call: 1 return-value: None
739
739
```
@@ -787,8 +787,8 @@ __Result:__
787
787
788
788
```
789
789
>> absolute of a number: 3
790
- >> random number between 0 and 1 0.9421784193905641
791
- >> random number between 0 and 1 0.2758141177857678
790
+ >> random number between 0 and 1 0.72300472140728
791
+ >> random number between 0 and 1 0.8604189007624241
792
792
```
793
793
794
794
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.
@@ -826,7 +826,7 @@ print("color red: ", colour_red , "red:", colour_red.red , "green:", colour_red.
826
826
__ Result:__
827
827
828
828
```
829
- >> color red: <__main__.Colour object at 0x7f865fe0afa0 > red: 255 green: 0 blue: 0
829
+ >> color red: <__main__.Colour object at 0x7fc95e4f6fa0 > red: 255 green: 0 blue: 0
830
830
```
831
831
832
832
At first it doesn't make an awfull lot of sense, but lets derive the ColourWithAlphaChannel class from Colour
@@ -857,7 +857,7 @@ print("color red: ", colour_red , "red:", colour_red.red , "green:", colour_red.
857
857
__ Result:__
858
858
859
859
```
860
- >> color red: <__main__.ColourWithAlphaChannel object at 0x7f865fde95b0 > red: 255 green: 0 blue: 0 alpha: 1.0
860
+ >> color red: <__main__.ColourWithAlphaChannel object at 0x7fc95e4d55b0 > red: 255 green: 0 blue: 0 alpha: 1.0
861
861
```
862
862
863
863
@@ -1036,30 +1036,33 @@ class Person:
1036
1036
self.last_name = last_name
1037
1037
1038
1038
def __eq__(self, other):
1039
- return (self.first_name, other.first_name ) == (self.last_name , other.last_name)
1039
+ return (self.first_name, other.last_name ) == (self.first_name , other.last_name)
1040
1040
1041
1041
def __lt__(self, other):
1042
1042
return (self.first_name, self.last_name) < (other.first_name, other.last_name)
1043
1043
1044
- person_a = Person("Jack", "Beean ")
1044
+ person_a = Person("Jack", "Bean ")
1045
1045
person_b = Person("Patricia", "Donovan")
1046
1046
1047
1047
print("person_a.__dict__ : ", person_a.__dict__)
1048
1048
print("person_b.__dict__ : ", person_b.__dict__)
1049
1049
1050
- assert not person_a == person_b
1050
+ assert person_a == person_b
1051
1051
assert person_a < person_b
1052
1052
# the added operators
1053
+ assert not person_a != person_b
1053
1054
assert person_a <= person_b
1055
+ assert not person_a > person_b
1056
+ assert not person_a >= person_b
1054
1057
1055
1058
```
1056
1059
1057
1060
__ Result:__
1058
1061
1059
1062
```
1060
- >> person_a.__dict__ : {'first_name': 'Jack', 'last_name': 'Beean '}
1063
+ >> person_a.__dict__ : {'first_name': 'Jack', 'last_name': 'Bean '}
1061
1064
>> person_b.__dict__ : {'first_name': 'Patricia', 'last_name': 'Donovan'}
1062
1065
```
1063
1066
1064
- ** * eof . tutorial ** *
1067
+ ** * eof tutorial ** *
1065
1068
0 commit comments