__init__ return value

Batista, Facundo FBatista at uniFON.com.ar
Wed Sep 24 13:30:39 EDT 2003


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
fbatista at unifon.com.ar
(54 11) 5130-4643
Cel: 15 5132 0132







More information about the Python-list mailing list