How to pass class instance to a method?

Dave Angel d at davea.name
Mon Nov 26 22:14:59 EST 2012


On 11/26/2012 05:18 PM, Steven D'Aprano wrote:
> On Mon, 26 Nov 2012 16:58:47 -0500, Dave Angel wrote:
>
>> In a statically typed language, the valid types
>> are directly implied by the function parameter declarations, while in a
>> dynamic language, they're defined in the documentation, and only
>> enforced (if at all) by the body of the function.
>
> Well that certainly can't be true, because you can write functions 
> without *any* documentation at all, and hence no defined type 
> restrictions that could be enforced:

That's backwards.  Any body should be a bug in that case.  It doesn't
matter what you pass to a function that is unspecified, it's behavior is
undefined.  Calling it is inherently illegal.

>
> def trivial_example(x):
>     return x+1
>
> No documentation, and so by your definition above this should be weakly 
> typed and operate on any type at all. Since there are no type 
> restrictions defined, the body cannot enforce those type restrictions. 
> But that's clearly not true.
>
> Please, everybody, before replying to this thread, please read this:
>
> http://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wrote/

I read part of it, and it's more than I care to read tonight.  It seems
to be written by an anonymous person.  By jumping around in his blog, I
see a lot of interesting articles, but i haven't yet figured out who he
is.  Does he have a name?  A degree, a job in computers, a reputation?





-- 

DaveA




More information about the Python-list mailing list