MonkeeSage <[EMAIL PROTECTED]> wrote: > It seems that I've got a short-circuit somewhere here. I understand > that everything is an object and the the storage/lookup system is > object-agnostic, and that it is only the descriptors (or "tags" as I > called them generically) that determine how an attribute is bound, > whether it is bound at all, whether it is even callable, and so forth. > So, when I say that all callable attributes (or to be more precise, > all callable attributes bound to objects other than toplevel) are > "methods," what am I missing? > > You said "the difference [between a callable attribute and a method] > is the specific implementation of the attribute's class"...but this > almost sounds like type-by-primitive (a method is a method when it > derives from a certain base class), or type-by-behavior (a method is a > method when it behaves in a certain way, e.g., responds in a certain > way to a query). Is this correct? Shouldn't it be type-by-capability/ > interface--i.e., it implements the protocol of a callable, therefore, > formally, it is not meaningfully different from any other callable > (quacks like a duck and all)? > > I guess what I'm asking is, in what way is a "method" (or "function") > semantically different from a home-brewed callable I concoct and bind > to an object (or toplevel)? What is the distinction that I'm missing?
--8<---------------cut here---------------start------------->8--- #!/usr/bin/env python class Foo(object): def __init__(self): def func(*args): return str(args) self.a=func def b(*args): return str(args) @classmethod def c(*args): return str(args) f=Foo() print f.a(1) # just a callble print f.b(1) # an instance method print f.c(1) # a class method --8<---------------cut here---------------end--------------->8--- Florian -- <http://www.florian-diesch.de/> ----------------------------------------------------------------------- ** Hi! I'm a signature virus! Copy me into your signature, please! ** ----------------------------------------------------------------------- -- http://mail.python.org/mailman/listinfo/python-list