def index(self):

George Sakkis george.sakkis at gmail.com
Wed Dec 20 19:04:43 EST 2006


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 ? and why not write something like @index.exposed ?
>
> in other words i have no idea what @ actually does i only know i have
> too write it to make it work :) Am guessing @ is something like
> prototyping in javascript but then def index is not a object but a
> method ? So that would not make sense ?
>
> oh and self stands more or less for private method right ?

Ouch. Do you really expect to learn a language from scratch by Q&A in a
malining list ? That's a very inefficient way to spend both yours and
others' time. Do your homework first by reading one of the several free
tutorials online and come back when you have trouble with something
specific you didn't understand.

George




More information about the Python-list mailing list