default repr?
Devin Jeanpierre
jeanpierreda at gmail.com
Sun Jul 22 20:44:56 EDT 2012
On Sun, Jul 22, 2012 at 8:29 PM, Chris Angelico <rosuav at gmail.com> wrote:
> On Mon, Jul 23, 2012 at 10:24 AM, Steven D'Aprano
> <steve+comp.lang.python at 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
More information about the Python-list
mailing list