Z
Zunbeltz Izaola
I've a clas with following methods:
class difracsocket:
def __init__(self,sock=None):
self.Handle = 1
[...]
def cliente(self,orden,respuesta):
[...]
def GetNewHandle(self):
newhandle = self.Handle
newhandle += 1
if newhandle > MAXHANDLE:
newhandle = 1
self.Handle = newhandle
return newhandle
def Move(self, table, angle,handle=1):
orden = instruccion(handle)
respuesta = instruccion
orden.Codigo = 6
Comando = "mvr "
if table == "TTH" or "tth":
Comando += "tth "
elif table == "TH" or "th":
Comando += "th "
Comando += str(angle)
orden.Comando = Comando
self.cliente(orden,respuesta)
return respuesta
I what to change de definiton of Move to something like
def Move(self, table, angle,handle=self.GetNewHandle)
File "comunicacion.py", line 201, in difracsocket
def Move(self,handle=self.GetNewHandle()):
NameError: name 'self' is not defined
Any hit? Can't i invoke methods in the definition of other methods?
Thanks in advance
Zunbeltz
class difracsocket:
def __init__(self,sock=None):
self.Handle = 1
[...]
def cliente(self,orden,respuesta):
[...]
def GetNewHandle(self):
newhandle = self.Handle
newhandle += 1
if newhandle > MAXHANDLE:
newhandle = 1
self.Handle = newhandle
return newhandle
def Move(self, table, angle,handle=1):
orden = instruccion(handle)
respuesta = instruccion
orden.Codigo = 6
Comando = "mvr "
if table == "TTH" or "tth":
Comando += "tth "
elif table == "TH" or "th":
Comando += "th "
Comando += str(angle)
orden.Comando = Comando
self.cliente(orden,respuesta)
return respuesta
I what to change de definiton of Move to something like
def Move(self, table, angle,handle=self.GetNewHandle)
File "comunicacion.py", line 201, in difracsocket
def Move(self,handle=self.GetNewHandle()):
NameError: name 'self' is not defined
Any hit? Can't i invoke methods in the definition of other methods?
Thanks in advance
Zunbeltz