python - type error when using class inheritence -


i have following code:

class sphericalrefraction(opticalelement):     def __init__(self, r0, normal, curvature, n, h):         self._r0 = r0         self._normal = normal/npl.norm(normal)         self._curvature = curvature         self._n = n         self._aperture = h  def outputplane(sphericalrefraction):     def __init__(self, r0, normal, h=15):         sphericalrefraction.__init__(self, r0=r0, normal=normal, curvature=0, n=1, h=h) 

but when construct class outputplane in main:

screen = r.outputplane(np.array([0,0,f]),np.array([0,0,1]), 5) 

i have following error:

typeerror: outputplane() takes 1 argument (3 given) 

what have done wrong? should can inherit outputplane sphericalrefraction?

you not inheriting sphericalrefraction because have defined outputplane function , not class.

so def outputplane(sphericalrefraction): should class outputplane(sphericalrefraction):


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -