no tupelunpacking

Radovan Garabik garabik at melkor.dnp.fmph.uniba.sk.spam
Fri May 19 08:29:35 EDT 2000


Thomas Thiele <thiele at muc.das-werk.de> wrote:
 : What is the best way to do this:

 : def f1( a, b ):
 : 	...do something with a und b...


 : def f2(...):
 : 	...calculate ret_a, ret_b
 : 	return ret_a, ret_b

 : ...

 : a, b = f2(...)
 : f1(a ,b) 

 : is o.k. (tupelunpacking, I know)

 : but I want to write:

 : f1(f2(...))

apply(f2, f1(...))


 : The problem happens if you have such a constructor __init__(self, *argv)
 : (Inside __init__ argv is a tupel), and you want to call this constructor
 : from a derived class.

 : class A:
 : 	def __init__(self, *argv):
 : 		...

 : class B(A):
 : 	def __init__(self, *argv):	
 : 		A.__init__(self, argv) #doesn't work!!!!

		apply(A.__init__, argv)

-- 
 -----------------------------------------------------------
| Radovan Garabik http://melkor.dnp.fmph.uniba.sk/~garabik/ |
| __..--^^^--..__    garabik @ melkor.dnp.fmph.uniba.sk     |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!



More information about the Python-list mailing list