Parent instance attribute access

marek.rocki at wp.pl marek.rocki at wp.pl
Mon Feb 25 06:44:44 EST 2008


Hello. Please post the minimal code that can be run and demonstrates
what's wrong. I tried the following and it works fine, args and kwargs
are visible:

class MyFactory(object):
	def __init__(self, *args, **kwargs):
		self.args = args
		self.kwargs = kwargs

class MyXmlFactory(MyFactory):
	def __init__(self, *args, **kwargs):
		MyFactory.__init__(self, *args, **kwargs)
	def build(self, addr):
		p = self.toto(*self.args, **self.kwargs)
		return p
	def toto(self, *args, **kwargs):
		print 'args in toto:', args
		print 'kwargs in toto:', kwargs
		return 'ok'

print MyXmlFactory(1, 2, 3, four = 4, five = 5).build(None)



More information about the Python-list mailing list