Arup Rakshit wrote:
> In this piece of code:
>
> class RefrigeratedShippingContainer(ShippingContainer):
> @staticmethod
> def _c_to_f(celsius):
> return celsius * 9/5 + 32
> @property
> def fahrenheit(self):
> return RefrigeratedShippingContainer._c_to_f(self.ce
On 03/18/2019 07:09 PM, Ben Finney wrote:
> Arup Rakshit writes:
>
> Michael Torrie writes:
>
>> On 03/18/2019 05:55 PM, Ben Finney wrote:
If I call `_c_to_f`, `_f_to_c` methods on `self` instead of
`RefrigeratedShippingContainer` class object, still it works.
>>>
>>> That's right, an
Arup Rakshit writes:
Michael Torrie writes:
> On 03/18/2019 05:55 PM, Ben Finney wrote:
> >> If I call `_c_to_f`, `_f_to_c` methods on `self` instead of
> >> `RefrigeratedShippingContainer` class object, still it works.
> >
> > That's right, and is indeed the point of making a static method on
On 03/18/2019 05:55 PM, Ben Finney wrote:
>> If I call `_c_to_f`, `_f_to_c` methods on `self` instead of
>> `RefrigeratedShippingContainer` class object, still it works.
>
> That's right, and is indeed the point of making a static method on a
> class.
I'm confused. The methods that refer to
Refi
Arup Rakshit writes:
> class RefrigeratedShippingContainer(ShippingContainer):
> # ...
>
> @staticmethod
> def _c_to_f(celsius):
> return celsius * 9/5 + 32
>
> @staticmethod
> def _f_to_c(fahrenheit):
> return (fahrenheit - 32) * 5/9
Both those functions are
Hi,
In this piece of code:
class RefrigeratedShippingContainer(ShippingContainer):
MAX_CELSIUS = 4.0
def __init__(self, owner_code, contents, celsius):
super().__init__(owner_code, contents)
if celsius > RefrigeratedShippingContainer.MAX_CELSIUS:
raise ValueE