text: Q:
  
  How can self denote Class1 and this at the same time?
  
  I have this code:
  class Class1():
    var1 = "var1"
    VAR2 = "VAR2"
  
    def __init__(self):
      self.var3 = "var3"
  
    def method1(self):
      print "var1 is: " + self.var1 # or Class1.var1, self denotes Class1
      print "var2 is: " + self.VAR2 # or Class1.VAR2, self denotes Class1
      print "var3 is: " + self.var3 # self denotes an instance of Class1
  
  c = Class1()
  c.method1()
  
  I am looking at this and I'm wondering: why does self in method1() refer to this (instance) and Class1 (class itself) at the same time? And should I use self or Class1 for var1 and VAR2? 
  And should I name "static" constants "var1" (small letter) or "VAR2" (BIG LETTERS)?
  
  A:
  
  When you look up an attribute on an instance of a class, Python first tries to find it on that instance.  If it's not there, it looks on the class.  (And if it's not there, it looks in the superclasses, all the way up the inheritance chain.)  self refers only to the instance, but the process of finding an attribute involves looking at the class (and superclasses) if necessary.  This is described in the documentation (see the sections on "Classes" and "Class instances").
  In your example, self.var3 finds the attribute on the instance.  self.var1 and self.var2 find it on the class.
  You can find many questions on StackOverflow arising from people trying to figure out the nuances of this in various situations.  Here is one example.
  As for how to name them, the standard convention is to use lowercase.  However, if you intend for them to be constant-like values, uppercase can be okay.  In either case, you should familiarize yourself with how class attributes actually work, so that you aren't surprised later when you try to do something with them.
  
  