B
Batista, Facundo
Studying the Tim Peter's FixedPoint code, found this:
# can we coerce to a float?
yes = 1
try:
asfloat = float(value)
except:
yes = 0
if yes:
self.__init__(asfloat, p)
return
This code is part of the __init__ method of the class.
The question is about the last two lines: When you call self.__init__(...),
doesn't it return a value that you should return too?
I thought it could be like this:
....
if yes:
newobject = self.__init__(asfloat, p)
return newobject
Thanks for all.
Facundo Batista
Gestión de Red
(e-mail address removed)
(54 11) 5130-4643
Cel: 15 5132 0132
# can we coerce to a float?
yes = 1
try:
asfloat = float(value)
except:
yes = 0
if yes:
self.__init__(asfloat, p)
return
This code is part of the __init__ method of the class.
The question is about the last two lines: When you call self.__init__(...),
doesn't it return a value that you should return too?
I thought it could be like this:
....
if yes:
newobject = self.__init__(asfloat, p)
return newobject
Thanks for all.
Facundo Batista
Gestión de Red
(e-mail address removed)
(54 11) 5130-4643
Cel: 15 5132 0132