Is duck-typing misnamed?

ROGER GRAYDON CHRISTMAN dvl at psu.edu
Sat Aug 27 19:28:09 EDT 2016


Your response is appreciated.   I just thought I'd comment a little more on the
script:

Woman:  I'm not a witch! I'm not a witch!

V:  ehh... but you are dressed like one.

W:  They dressed me up like this!

All: naah  no we didn't... no.

W:  And this isn't my nose, it's a false one.

(V lifts up carrot)

V: Well?

P1:  Well we did do the nose

V: The nose?

P1:  ...And the hat, but she is a witch!


They took a woman who originally, I think we might agree, was not a witch,
and they added features that were understood to be part of the protocol
for witchiness.

I think this is very much like me defining methods __iter__ and __next__
and voila, I've turned something into an iterator by witch --  er.. duck-typing!

Perhaps she inherited her weight from her latent duckness.

Thoughts?

Roger Christman

On Sat, Aug 27, 2016 06:27 PM, python-list at python.org wrote:
>
On 26Aug2016 19:58, ROGER GRAYDON CHRISTMAN <dvl at psu.edu> wrote:
>>"If it walks like a duck, quacks like a duck,... "
>>so there is indeed precedence for this so-called 'duck typing'
>>
>>but wouldn't it be more Pythonic to call this 'witch typing'?
>>"How do you know she is a witch?"
>>"She looks like one."
>>etc.
>>
>>I do grant that ultimately, the duck does come into play, since the witch
>>weighs the same as a duck.
>
>I disagree. They want to burn her because she's supposedly a witch, but the 
>scientific test was that she weighed as much as a duck. So I think your second 
>example is also duck typing: functioning like a duck.
>
>Cheers,
>Cameron Simpson <cs at zip.com.au>
>
>
>




More information about the Python-list mailing list