Re: staticmethod and setattr

2010-03-15 Thread Jean-Michel Pichavant
Am Montag, den 15.03.2010, 05:42 -0700 schrieb Michael.Lausch: On Mar 15, 11:40 am, Steven D'Aprano wrote: On Mon, 15 Mar 2010 01:43:02 -0700, Michael.Lausch wrote: Hi, I managed to get confused by Python, which is not such an easy task. The problem i have is root

Re: staticmethod and setattr

2010-03-15 Thread Andreas Löscher
Am Montag, den 15.03.2010, 05:42 -0700 schrieb Michael.Lausch: > On Mar 15, 11:40 am, Steven D'Aprano cybersource.com.au> wrote: > > On Mon, 15 Mar 2010 01:43:02 -0700, Michael.Lausch wrote: > > > Hi, > > > > > I managed to get confused by Python, which is not such an easy task. > > > > > The prob

Re: staticmethod and setattr

2010-03-15 Thread Bruno Desthuilliers
Michael.Lausch a écrit : (snip) Now I'm trying to understand why this is the case. How is Foo.__dict__['_ref'] different from Foo._ref? Shouldn't it return the same attribute? It's an application of the descriptor protocol: http://wiki.python.org/moin/FromFunctionToMethod -- http://mail.py

Re: staticmethod and setattr

2010-03-15 Thread Michael.Lausch
On Mar 15, 11:40 am, Steven D'Aprano wrote: > On Mon, 15 Mar 2010 01:43:02 -0700, Michael.Lausch wrote: > > Hi, > > > I managed to get confused by Python, which is not such an easy task. > > > The problem i have is rooted in marshalling, JSON and Dojo. I need some > > static class in function with

Re: staticmethod and setattr

2010-03-15 Thread Steven D'Aprano
On Mon, 15 Mar 2010 01:43:02 -0700, Michael.Lausch wrote: > Hi, > > I managed to get confused by Python, which is not such an easy task. > > The problem i have is rooted in marshalling, JSON and Dojo. I need some > static class in function with the name "$ref" i tried: > class Foo(object): >

staticmethod and setattr

2010-03-15 Thread Michael.Lausch
Hi, I managed to get confused by Python, which is not such an easy task. The problem i have is rooted in marshalling, JSON and Dojo. I need some static class in function with the name "$ref" i tried: class Foo(object): @staticmethod def _ref(o): pass setattr(Foo, "$ref", Foo._re