def index(self):

Chris Lambacher chris at kateandchris.net
Mon Dec 18 15:53:20 EST 2006


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.
> 
> <code>
> class HelloWorld:
>  def index(self):
>   index.exposed = True
index is not defined. HelloWorld.index is and self.index is, but index is not.
>   return "Hello world!"
> </code>
> 
> and
> 
> <code>
> class HelloWorld:
>  def index(self):
>   self.exposed = True
>   return "Hello world!"
> </code>

If you are just starting to explore Python, the console is great for trying
stuff out.

-Chris


> -- 
> http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list