Re: returning self
"Mark Hahn" <[email protected]> Fri, 26 Mar 2004 12:00:14 -0800
| Newsgroups | gmane.comp.lang.prothon.devel,gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <007701c4136c$f4659430$d701a8c0@MarkVaio> |
I also got caught by the self return in a case like you mention just last night. If I don't hear any other arguments I'll go back to None, but then I have a big problem with __init__ to resolve. It is "prothonesque" to allow __init__ to return any object, yet forgetting to put "return ." ( read return self) at the end of __init__ is disastrous as I did over and over in testing. You get a nice None object for your new creation. People new to Prothon coming from Python are sure to do this. ----- Original Message ----- From: "Dennis Heuer" <[email protected]> To: <[email protected]> Sent: Friday, March 26, 2004 8:14 AM Subject: [Prothon-dev] returning self > I disagree with you that a function should return self. At least if self > is True. I use the return of none as an indicator in that I ask: > > if thingsHappened(): go on! > > or: > > if not thingsHappened(): raise MyError > > That's a very useful functionality in very many cases and trumps your > single advantage you mentioned (__init__). > > regards, > > Dennis > > > _______________________________________________ > Prothon-dev mailing list > [email protected] > http://lists.prothon.org/mailman/listinfo/prothon-dev > > > >