> Though I solved the problem by making database an instance variable,
> there's one thing I'm curious about. If I 'overwrite' a class variable
> with an instance one (as I did originally), is the class variable
> recoverable? 

Yes, you can always access the class version by using the class 
as the accessor

class C:
     cv = 42   # class variable

c = C()
c.cv = 666   # create instance cv in c
c2 = C()

print c.cv  # -> 666
print C.cv   # -> 42
print c2.cv  # -> 42, new instance so no instance variable exists


> Will objects created later have the class or the instance
> variable?

The class one. The instance variable you create is purely 
in that one instance. You do not alter the class definition 
so new instamces do not pick it up.

HTH,

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to