On 12/06/20 9:32 AM, zljubi...@gmail.com wrote:
OK, as I can see nothing is enforced but I can use mypy and tests for the
purpose.
Exactly! Well done - Python uses 'duck typing' and thus when the Typing
module was added, it became an option. As mentioned elsewhere, it
provides "hints" at
OK, as I can see nothing is enforced but I can use mypy and tests for the
purpose.
As I am using pycharm, looks like I need a plugin for mypy.
There are two of them out there:
non official: https://plugins.jetbrains.com/plugin/11086-mypy
and official:
On 12/06/20 8:51 AM, zljubi...@gmail.com wrote:
Hi,
If I run this code:
class Property:
def __init__(self, var: int):
self.a: int = var
@property
def a(self):
return self.__a
@a.setter
def a(self, var: int):
if var > 0 and var % 2 == 0:
> On 11 Jun 2020, at 21:51, zljubi...@gmail.com wrote:
>
> Hi,
>
> If I run this code:
> class Property:
>
>def __init__(self, var: int):
>self.a: int = var
>
>@property
>def a(self):
>return self.__a
>
>@a.setter
>def a(self, var: int):
>if var
Hi,
If I run this code:
class Property:
def __init__(self, var: int):
self.a: int = var
@property
def a(self):
return self.__a
@a.setter
def a(self, var: int):
if var > 0 and var % 2 == 0:
self.__a = var
else:
self.__a