"Serdar Tumgoren" <zstumgo...@gmail.com> wrote
Meantime, how do I pass "self" to DataSources?
Do I literally just pass in the word "self" from inside the calling
object? Apologies for the confusion -- I've never used that technique
before and it's bending my brain a little:)
self is just a reference to the current object.
Thus when you write:
class C:
def f(self): pass
and call it with
c = C()
c.f()
you are effectively calling
C.f(c)
ie self takers on the value of the current instance.
Thus inside f() if you hasd a line
DataSources.getData(self)
you would pass the instance of C to DataSources.
(and you can use isInstance() to check its type).
But unless you have a really good reason its still better
to get the class to do its own SQL. IMHO.
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor