I had a look at the new reference implementation of PEP 246
(Object Adaptation) and I feel uneasy with one specific point
of this new version. I don't fully understand why it checks
if *the type of* the protocol has a method "__adapt__":
...
# (c) then check if protocol.__adapt__ exists
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:
>
>
>I had a look at the new reference implementation of PEP 246
>(Object Adaptation) and I feel uneasy with one specific point
>of this new version. I don't fully understand why it checks
>if *the type of* the protocol has a method "__adapt_
[EMAIL PROTECTED] (Magnus Lie Hetland) wrote in message news:<[EMAIL
PROTECTED]>...
> In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED] wrote:
> >
> >
> >I had a look at the new reference implementation of PEP 246
> >(Object Adaptation) and I feel uneasy with one specific point
> >of this new ve
In article <[EMAIL PROTECTED]>,
S?bastien Boisg?rault wrote:
[snip]
> Agreed. Consistency matters. But precisely because Python looks in
> the type of the object (and not the object itself), I don't need to
> explicitely check the type myself: the code adapt =
> getattr(protocol, '__adapt__') will
> >Have you read the BDFL's "Python Optional Typechecking Redux" ?
>
> Yes.
>
> >(http://www.artima.com/weblogs/viewpost.jsp?thread=89161)
> >It's usage of adapt assumes that "a class is a protocol", so I
> >guess that it does not work with the new version of PEP 246.
>
> Why not? There's nothin