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


Groups > comp.lang.python > #25834

Re: default repr?

References <CAGGBd_oD9tT6Ej0NdsPF7-VRda1k_GQmUQAuutg-eO+XbdYD3Q@mail.gmail.com> <mailman.2444.1342997643.4697.python-list@python.org> <500c99d5$0$29978$c3e8da3$5496439d@news.astraweb.com> <CAPTjJmr=QTWyJT5s71bU8ej=bNgibOdu2JApbFkKCm8TJzWi5w@mail.gmail.com>
From Devin Jeanpierre <jeanpierreda@gmail.com>
Date 2012-07-22 20:44 -0400
Subject Re: default repr?
Newsgroups comp.lang.python
Message-ID <mailman.2448.1343004339.4697.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, Jul 22, 2012 at 8:29 PM, Chris Angelico <rosuav@gmail.com> wrote:
> On Mon, Jul 23, 2012 at 10:24 AM, Steven D'Aprano
> <steve+comp.lang.python@pearwood.info> wrote:
>> Not quite: they have to be an instance of that class.
----8<----
> Hmm. I would have thought that methods were like all other functions:
> they take their arguments and do code with them. Duck typing and all.
> I stand corrected, then.

On Python 3 you are correct.

>>> class A:
...     def print(self):
...             print(self)
...
>>> A.print(2)
2

-- Devin

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


Thread

Re: default repr? Chris Angelico <rosuav@gmail.com> - 2012-07-23 08:54 +1000
  Re: default repr? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-23 00:24 +0000
    Re: default repr? Chris Angelico <rosuav@gmail.com> - 2012-07-23 10:29 +1000
      Re: default repr? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-23 01:40 +0000
    Re: default repr? Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-07-22 20:44 -0400

csiph-web