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


Groups > comp.lang.python > #99075

Re: Why doesn't this method have access to its "self" argument?

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Why doesn't this method have access to its "self" argument?
Date 2015-11-20 04:34 +1100
Message-ID <mailman.472.1447954477.16136.python-list@python.org> (permalink)
References <db6apoFgvjlU1@mid.individual.net>

Show all headers | View raw


On Fri, Nov 20, 2015 at 3:13 AM, Robert Latest via Python-list
<python-list@python.org> wrote:
> rl@dc:~/c/cwsf/python_module$ python test.py
>
> Minimal example files:
>
> ========================== test.py ===================================
>
> import cmethod
>
> class Test():
>
> # add methods to the class "after the fact"
> Test.py_method = py_method
> Test.c_method = cmethod.c_method

Are you using Python 2 here? If so, you're using an old-style class,
which has specific consequences that I can never remember. Does the
situation change if you slap 'object' between those parentheses? Or if
you use Python 3?

ChrisA

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


Thread

Why doesn't this method have access to its "self" argument? Robert Latest <boblatest@yahoo.com> - 2015-11-19 16:13 +0000
  Re: Why doesn't this method have access to its "self" argument? Chris Angelico <rosuav@gmail.com> - 2015-11-20 04:34 +1100
  Re: Why doesn't this method have access to its "self" argument? Peter Otten <__peter__@web.de> - 2015-11-19 19:00 +0100
  Re: Why doesn't this method have access to its "self" argument? dieter <dieter@handshake.de> - 2015-11-20 08:18 +0100

csiph-web