Re: def index(self):

2006-12-22 Thread Gert Cuykens
Ok thx i think i understand it now >>> class C: ... @staticmethod ... def fn(): ... return 'whohoo' ... >>> C.fn() 'whohoo' >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: def index(self):

2006-12-22 Thread Duncan Booth
"Gert Cuykens" <[EMAIL PROTECTED]> wrote: > On 21 Dec 2006 09:44:48 GMT, Duncan Booth > <[EMAIL PROTECTED]> wrote: >> "George Sakkis" <[EMAIL PROTECTED]> wrote: >> >> @expr >> def fn(...): ... >> >> is exactly equivalent to: >> >> def fn(...): ... >> fn = (expr)(fn) >> > > ok i did my homework r

Re: def index(self):

2006-12-22 Thread Fredrik Lundh
Marc 'BlackJack' Rintsch wrote: > This depends on the definition of `expr`. If `expr` includes the > possibility of enclosing parenthesis then yes. There are scenarios where > you would need them. For example if you use objects that overload > operators to build a callable used as decorator: >

Re: def index(self):

2006-12-21 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Gert Cuykens wrote: > On 21 Dec 2006 09:44:48 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: >> "George Sakkis" <[EMAIL PROTECTED]> wrote: >> >> @expr >> def fn(...): ... >> >> is exactly equivalent to: >> >> def fn(...): ... >> fn = (expr)(fn) >> > > ok i did my homework re

Re: def index(self):

2006-12-21 Thread Gert Cuykens
On 21 Dec 2006 09:44:48 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: > "George Sakkis" <[EMAIL PROTECTED]> wrote: > > @expr > def fn(...): ... > > is exactly equivalent to: > > def fn(...): ... > fn = (expr)(fn) > ok i did my homework reading about decorators http://www.python.org/doc/2.4.4/whatsn

Re: def index(self):

2006-12-21 Thread Duncan Booth
"George Sakkis" <[EMAIL PROTECTED]> wrote: > Gert Cuykens wrote: >> > > class HelloWorld(object): >> > > @cherrypy.exposed >> > > def index(self): >> > >return "Hello World" >> >> do i have to

Re: def index(self):

2006-12-20 Thread George Sakkis
Gert Cuykens wrote: > > > class HelloWorld(object): > > > @cherrypy.exposed > > > def index(self): > > >return "Hello World" > > do i have to write @cherrypy.exposed before every def or just once for > all the def's ? an

Re: def index(self):

2006-12-20 Thread Gert Cuykens
> > class HelloWorld(object): > > @cherrypy.exposed > > def index(self): > >return "Hello World" do i have to write @cherrypy.exposed before every def or just once for all the def's ? and why not write something like @index.exposed ? in oth

Re: def index(self):

2006-12-20 Thread Bruno Desthuilliers
e second won't >>>>probably work as expected with CherryPy. >>> >>> >>>class HelloWorld: >>>def index(self): >>> return "Hello world!" >>>index.exposed = True #DOOH! >> >>And the winner is >>

Re: def index(self):

2006-12-19 Thread Tim Roberts
as expected with CherryPy. >> >> >> class HelloWorld: >> def index(self): >> return "Hello world!" >> index.exposed = True #DOOH! > >And the winner is > >> > >The whole thing, I guess. While Python is quite easy to get s

Re: def index(self):

2006-12-19 Thread Bruno Desthuilliers
Gert Cuykens a écrit : >> FWIW, the first version raises an exception (unless of course the name >> 'index' is already bound in the enclosing scope). And the second won't >> probably work as expected with CherryPy. > > > > class HelloWor

Re: def index(self):

2006-12-18 Thread Gert Cuykens
> FWIW, the first version raises an exception (unless of course the name > 'index' is already bound in the enclosing scope). And the second won't > probably work as expected with CherryPy. class HelloWorld: def index(self): return "Hello world!" index.exp

Re: def index(self):

2006-12-18 Thread Bruno Desthuilliers
Gert Cuykens a écrit : > Is there a difference between > > > class HelloWorld: > def index(self): > index.exposed = True > return "Hello world!" > > > and > > > class HelloWorld: > def index(self): > self.exposed = True > return

Re: def index(self):

2006-12-18 Thread Chris Lambacher
On Mon, Dec 18, 2006 at 08:40:13PM +0100, Gert Cuykens wrote: > Is there a difference between Yes. The first one causes an exception and the second one doesn't. > > > class HelloWorld: > def index(self): > index.exposed = True index is not defined. HelloWorld.index is

Re: def index(self):

2006-12-18 Thread Jussi Salmela
Gert Cuykens kirjoitti: > Is there a difference between > > > class HelloWorld: > def index(self): > index.exposed = True > return "Hello world!" > > > and > > > class HelloWorld: > def index(self): > self.exposed = True > retu

def index(self):

2006-12-18 Thread Gert Cuykens
Is there a difference between class HelloWorld: def index(self): index.exposed = True return "Hello world!" and class HelloWorld: def index(self): self.exposed = True return "Hello world!" -- http://mail.python.org/mailman/listinfo/python-list