Instance variables question

Joseph L. Casale jcasale at activenetwerx.com
Mon Apr 16 12:22:46 EDT 2018


From: Python-list <python-list-bounces+jcasale=activenetwerx.com at python.org> on behalf of Irv Kalb <Irv at furrypants.com>
Sent: Monday, April 16, 2018 10:03 AM
To: python-list at python.org
Subject: Instance variables question
    
> class PartyAnimal():
>     x = 0
> 
>     def party(self):
>         self.x = self.x + 1
>         print('So far', self.x)

Your not accessing the class variable here, self.x != PartyAnimal.x.


More information about the Python-list mailing list