self in not a keyword in python, is only a convention for the first parameter for bound method. It refers to the instance of the class so you cannot use in the class definition. You should read something about "bound" and "unbound" methods in python.
Hope this help S. 2011/3/2 Alex Hall <mehg...@gmail.com>: > Hi all, > Still working through that tutorial. I am just curious: why are none > of the class variables called self.var, but rather just var? For > example: > import models > class Poll(models.Model): > question=models.CharField(max_length=200) > > Should that not be > self.question=... > instead? Otherwise, saying something like: > poll=Poll() > poll.question="question?" > should not work; question is not told to be part of the class by way > of self. This may stray from django and into pure python territory, so > sorry if it gets off-topic. I have never seen a class that does not > tie its variables to itself with self or some other keyword. Come to > think of it, there is no __init__ method. I know that it is not > necessary to have one, but I figured I would have seen one to get > things set up. > > -- > Have a great day, > Alex (msg sent from GMail website) > mehg...@gmail.com; http://www.facebook.com/mehgcap > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.