newbie namespace question

Chris Green sprout at dok.org
Tue Jul 27 15:35:53 EDT 1999


A long time ago, I swore I read something that answered this but I am
unable to find it in any of the docs or faq.

How can a subfunction of a method of a class access the other members
of a class? I'm playing with pygtk and more or less munging what was
already in the test gtk example.

class TimeCalc:
	def __init__:
		[ snip ]
		self.make_list()
	def make_list():
		s=[0 , 0]

		def select_clist(self, row, col, event, selected=s):
			print self.get_text(row,col)	
               self.m_clist.connect("select_row", select_clist)
	def grok_data():
		pass

Ok. Excuse the bad example but when select_clist is called, how can I
access the previous self so that I can use self.grok_data().

I vaguely remember running into this problem before and just
reorganizing my class to get around it.  What is the proper way to do
this? (and if they aren't the same, how do you bump up one level in
namespaces? :) )

Thanks,
Chris
-- 
Chris Green <sprout at dok.org> <grapeape at uab.edu>
Let not the sands of time get in your lunch.




More information about the Python-list mailing list