Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33954
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'argument': 0.04; 'run-time': 0.05; 'parameter': 0.07; 'statically': 0.07; 'subject:How': 0.09; 'python': 0.09; 'declarations': 0.09; 'subject:method': 0.09; 'typed': 0.09; 'typeerror:': 0.09; 'def': 0.10; 'language,': 0.11; 'static': 0.13; 'foo(object):': 0.16; 'subject:class': 0.16; 'subject:instance': 0.16; 'subject:pass': 0.16; 'unbound': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'instance': 0.17; '>>>': 0.18; '"",': 0.22; 'defined': 0.22; 'example': 0.23; 'pass': 0.25; 'header:In-Reply-To:1': 0.25; '(most': 0.27; 'message- id:@mail.gmail.com': 0.27; 'checking.': 0.29; 'implied': 0.29; 'class': 0.29; 'received:209.85.215.46': 0.30; 'function': 0.30; 'file': 0.32; 'function.': 0.33; 'int': 0.33; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'languages': 0.33; 'received:google.com': 0.34; 'nov': 0.35; 'pm,': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'method': 0.36; 'uses': 0.37; 'previous': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'perform': 0.38; 'to:addr:python.org': 0.39; 'called': 0.39; 'header:Received:5': 0.40; 'first': 0.61; '26,': 0.65; 'enforced': 0.84; 'to:name:python': 0.84; 'angel': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=DgFtFnai8DH1HIuOOF2fcmpJSHZ/1XxxY/8u3mDyhK8=; b=hQcj8X5VIEcobDeQdVeDNobKFKLkNw63D0kZTe6IHEL9OcGEfVcojXN4WyuRxRowHX 9YcG+xiGyDwJjsWKf1UVGozMVphUfs8ihZrDN5s16KEVaqgoYTXP5cpZtYvts8mit3et Yfyr+f3p24u91dTd15jDkpRgXhMxBdLW6a0bZL3BGHoiVQAo+RymH1zzLW9C0d84Fetb 7JBmVeS9B1PB9Fk6FTSkeTNoEwJ6Yfsgr7Hm/SlenCQ/kjyySPZnGWafHnpeWnfigzpF NquOQEvHsV4SoHZlciXSbUVaJxz+8AYWl4O3HW1hRM93V3ehlOJ3+DfRHCLaqQPoqBNk P1+Q== |
| MIME-Version | 1.0 |
| In-Reply-To | <50B3E617.3040302@davea.name> |
| 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> <50B3E617.3040302@davea.name> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Mon, 26 Nov 2012 16:07:10 -0700 |
| Subject | Re: How to pass class instance to a method? |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.304.1353971263.29569.python-list@python.org> (permalink) |
| Lines | 24 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1353971263 news.xs4all.nl 6879 [2001:888:2000:d::a6]:33568 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:33954 |
Show key headers only | View raw
On Mon, Nov 26, 2012 at 2:58 PM, Dave Angel <d@davea.name> wrote: > Not how I would put it. In a statically typed language, the valid types > are directly implied by the function parameter declarations, As alluded to in my previous post, not all statically typed languages require parameter type declarations to perform static checking. > while in a > dynamic language, they're defined in the documentation, and only > enforced (if at all) by the body of the function. That's not even true for Python. The following example uses Python 2.x: >>> class Foo(object): ... def method(self): ... pass ... >>> Foo.method(4) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unbound method method() must be called with Foo instance as first argument (got int instance instead) That's a run-time check, and it's not enforced by the body of the function.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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