class scope questions

Paul Prescod paulp at ActiveState.com
Fri Feb 9 14:11:58 EST 2001


Ben de Luca wrote:
> 
> if i do this
> 
> class a:
>          dog='woof'
> 
>           def blah():
>                     something
> 
> how do i call a
> how do i get soemthing in blah to refernce dog? either to read it or write
> to it

class a:
    dog='woof'
    def blah(self ):
       print a.dog
       a.dog="woof woof"




More information about the Python-list mailing list