Re: Difference between 'function' and 'method'

2008-03-08 Thread castironpi
On Mar 7, 1:34 pm, [EMAIL PROTECTED] wrote: > On Mar 7, 6:44 am, Sion Arrowsmith <[EMAIL PROTECTED]> > wrote: > > > Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > >En Thu, 06 Mar 2008 23:46:43 -0200, <[EMAIL PROTECTED]> escribi�: > > >> [ ... ] > > >You may look at the SimpleXMLRPCServer class

Re: Difference between 'function' and 'method'

2008-03-07 Thread castironpi
On Mar 7, 6:44 am, Sion Arrowsmith <[EMAIL PROTECTED]> wrote: > Gabriel Genellina <[EMAIL PROTECTED]> wrote: > >En Thu, 06 Mar 2008 23:46:43 -0200, <[EMAIL PROTECTED]> escribi�: > >> [ ... ] > >You may look at the SimpleXMLRPCServer class and see how it implements   > >introspection. It's rather

Re: Difference between 'function' and 'method'

2008-03-07 Thread Sion Arrowsmith
Gabriel Genellina <[EMAIL PROTECTED]> wrote: >En Thu, 06 Mar 2008 23:46:43 -0200, <[EMAIL PROTECTED]> escribi�: >> [ ... ] >You may look at the SimpleXMLRPCServer class and see how it implements >introspection. It's rather easy (and doesn't require metaclasses nor >decorators nor any other fa

Re: Difference between 'function' and 'method'

2008-03-07 Thread Gabriel Genellina
En Thu, 06 Mar 2008 23:46:43 -0200, <[EMAIL PROTECTED]> escribi�: > oss.message is a abstraction class that writes the method name into a > string, then sends it to OSS... outgoingserver or serverside. > > Now that I'm writing it, and this is important, -to- the -newsgroup-, > I realize you could

Re: Difference between 'function' and 'method'

2008-03-06 Thread castironpi
On Mar 6, 7:10 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 06 Mar 2008 22:56:33 -0200, <[EMAIL PROTECTED]> escribió: > > > On Mar 6, 5:35 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > >> p = P() > >> print p.bar.func_name # -> bar > >> p.bar.im_func.anotherattribute = 1 >

Re: Difference between 'function' and 'method'

2008-03-06 Thread Gabriel Genellina
En Thu, 06 Mar 2008 22:56:33 -0200, <[EMAIL PROTECTED]> escribió: > On Mar 6, 5:35 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >> >> p = P() >> print p.bar.func_name # -> bar >> p.bar.im_func.anotherattribute = 1 >> print p.bar.anotherattribute # -> 1 >> >> (the attribute must be set on the

Re: Difference between 'function' and 'method'

2008-03-06 Thread castironpi
On Mar 6, 5:35 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 05 Mar 2008 02:57:58 -0200, <[EMAIL PROTECTED]> escribi�: > > > > > > >> > > >> >> Can you overload -type-'s decision of what to 'bind'?...   > >> whenever it > >> > > >> >> is it makes it. > > >> > > >> Use delegation inst

Re: Difference between 'function' and 'method'

2008-03-06 Thread Gabriel Genellina
En Wed, 05 Mar 2008 02:57:58 -0200, <[EMAIL PROTECTED]> escribi�: >> > > >> >> Can you overload -type-'s decision of what to 'bind'?... >> whenever it >> > > >> >> is it makes it. >> >> > > >> Use delegation instead of inheritance. This class is almost   >> > > >> indistinguishable from a true f

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
On Mar 4, 10:57 pm, [EMAIL PROTECTED] wrote: > > > > >> >> Can you overload -type-'s decision of what to 'bind'?... whenever > > > > >> >> it > > > > >> >> is it makes it. > > > > > >> from types import FunctionType, MethodType > > > > >> class A( FunctionType ): pass > > > > >> > ... >

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
> > > >> >> Can you overload -type-'s decision of what to 'bind'?... whenever it > > > >> >> is it makes it. > > > > >> from types import FunctionType, MethodType > > > >> class A( FunctionType ): pass > > > >> > ... > > > >> > Traceback (most recent call last): > > > >> >   File "", line

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
On Mar 4, 9:53 pm, [EMAIL PROTECTED] wrote: > > >> >> Can you overload -type-'s decision of what to 'bind'?... whenever it > > >> >> is it makes it. > > > >> from types import FunctionType, MethodType > > >> class A( FunctionType ): pass > > >> > ... > > >> > Traceback (most recent call l

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
On Mar 4, 9:01 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 05 Mar 2008 00:30:26 -0200, <[EMAIL PROTECTED]> escribió: > > > On Mar 4, 8:11 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > >> En Tue, 04 Mar 2008 16:45:40 -0200, <[EMAIL PROTECTED]> escribió: > > >> >> Can you over

Re: Difference between 'function' and 'method'

2008-03-04 Thread Gabriel Genellina
En Wed, 05 Mar 2008 00:30:26 -0200, <[EMAIL PROTECTED]> escribió: > On Mar 4, 8:11 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >> En Tue, 04 Mar 2008 16:45:40 -0200, <[EMAIL PROTECTED]> escribió: >> >> >> Can you overload -type-'s decision of what to 'bind'?... whenever it >> >> is it makes

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
On Mar 4, 8:11 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 04 Mar 2008 16:45:40 -0200, <[EMAIL PROTECTED]> escribió: > > >> > So, to answer your question: what you are decorating are functions,   > >> not > >> > methods. > > >> Can you overload -type-'s decision of what to 'bind'?.

Re: Difference between 'function' and 'method'

2008-03-04 Thread Gabriel Genellina
En Tue, 04 Mar 2008 16:45:40 -0200, <[EMAIL PROTECTED]> escribió: >> > So, to answer your question: what you are decorating are functions, >> not >> > methods. >> >> Can you overload -type-'s decision of what to 'bind'?... whenever it >> is it makes it. > from types import FunctionType, Met

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
> > So, to answer your question: what you are decorating are functions, not > > methods. > > Can you overload -type-'s decision of what to 'bind'?... whenever it > is it makes it. >>> from types import FunctionType, MethodType >>> class A( FunctionType ): pass ... Traceback (most recent call last)

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
On Mar 4, 5:27 am, Bruno Desthuilliers wrote: > ?? a écrit : > > > Howdy everyone, > > >      This is a big problem puzzles me for a long time. The core question is: > > How to dynamically create methods on a class or an instance? > > class Foo(object): >     pass > > def bar(self, arg): >     pri

Re: Difference between 'function' and 'method'

2008-03-04 Thread Bruno Desthuilliers
?? a écrit : > Howdy everyone, > > This is a big problem puzzles me for a long time. The core question is: > How to dynamically create methods on a class or an instance? class Foo(object): pass def bar(self, arg): print "in bar : self == % - arg == %s" % (self, str(arg)) def baaz(s

Re: Difference between 'function' and 'method'

2008-03-04 Thread Paul Boddie
On 4 Mar, 09:22, "甜瓜" <[EMAIL PROTECTED]> wrote: > > This is a big problem puzzles me for a long time. The core question is: > How to dynamically create methods on a class or an instance? > > Let me state it step by step. > 1. > def gunc(self): > pass > class A(object): > def func(self

Difference between 'function' and 'method'

2008-03-04 Thread 甜瓜
Howdy everyone, This is a big problem puzzles me for a long time. The core question is: How to dynamically create methods on a class or an instance? Let me state it step by step. 1. def gunc(self): pass class A(object): def func(self): pass a = A() a.func # gives "bound met