Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33961

Re: How to pass class instance to a method?

Date 2012-11-26 22:14 -0500
From Dave Angel <d@davea.name>
Subject Re: How to pass class instance to a method?
References <3193e3dd-0507-4ff7-9026-ee80e5d9c1dd@googlegroups.com> <pan.2012.11.26.16.56.29.389000@nowhere.com> <CALwzidn54ko2AGEj2QmanfFsoUBSqrNJ=TwNjCJt7-+_O2qu-w@mail.gmail.com> <mailman.300.1353967142.29569.python-list@python.org> <50b3eab5$0$29994$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.307.1353986116.29569.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to pass class instance to a method? ALeX inSide <alex.b.inside@gmail.com> - 2012-11-25 04:11 -0800
  Re: How to pass class instance to a method? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-25 12:37 +0000
  Re: How to pass class instance to a method? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2012-11-26 11:22 +1300
  Re: How to pass class instance to a method? Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2012-11-26 11:08 +0100
  Re: How to pass class instance to a method? Nobody <nobody@nowhere.com> - 2012-11-26 16:56 +0000
    Re: How to pass class instance to a method? Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-26 13:51 -0700
    Re: How to pass class instance to a method? Dave Angel <d@davea.name> - 2012-11-26 16:58 -0500
      Re: How to pass class instance to a method? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-26 22:18 +0000
        Re: How to pass class instance to a method? Dave Angel <d@davea.name> - 2012-11-26 22:14 -0500
          Re: How to pass class instance to a method? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-27 04:10 +0000
            Re: How to pass class instance to a method? Roy Smith <roy@panix.com> - 2012-11-26 23:25 -0500
            Re: How to pass class instance to a method? Dave Angel <d@davea.name> - 2012-11-27 00:18 -0500
    Re: How to pass class instance to a method? Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-26 16:07 -0700
      Re: How to pass class instance to a method? Hans Mulder <hansmu@xs4all.nl> - 2012-11-27 01:36 +0100
    Re: How to pass class instance to a method? Dave Angel <d@davea.name> - 2012-11-26 21:50 -0500
  Re: How to pass class instance to a method? Drew <r.drew.davis@gmail.com> - 2012-11-26 17:14 -0800

csiph-web