When I go to create an object I want to be able to decide whether the 
object is valid or not in __init__, and if not, I want the constructor to 
return something other than an object, (like maybe None). I seem to be 
having problems. At the end of __init__ I say (something like)

        if self.something < minvalue:
            del self
            return None

and it doesn't work. I first tried just the return None, then I got crafty 
and tried the del self. Is what I'm trying to do possible in the 
constructor or do I have to check after I return? Or would raising an 
exception in the constructor be appropriate?

Am I even being clear?

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to