On Sun, Jun 14, 2020 at 9:04 AM Oleg Broytman wrote:
> On Sun, Jun 14, 2020 at 03:33:16PM -, artem6191 <
> artem129...@gmail.com> wrote:
> > This attribute will use for convertion classes to other types, i.e.
> int(MyClass) will return __convert__ result in MyClass
>Define ``__int__`` or
zope.interface provides an implementation of PEP 246. That PEP defines a
`__conform__` method objects can use to adapt themselves to a prototype:
>>> from zope.interface.common.numbers import IIntegral
>>> class MyClass:
... def __init__(self, number: int):
... self.number = number
... d
On 2020-06-14 12:33 p.m., artem6191 wrote:
This attribute will use for convertion classes to other types, i.e.
int(MyClass) will return __convert__ result in MyClass
Example:
class MyClass:
def __init__(self, numer: int):
self.number = number
def __convert__(self, type):
On Sun, Jun 14, 2020 at 03:33:16PM -, artem6191
wrote:
> This attribute will use for convertion classes to other types, i.e.
> int(MyClass) will return __convert__ result in MyClass
>
> Example:
> class MyClass:
>def __init__(self, numer: int):
> self.number = number
>def __c