[Tutor] best practice: throw exception or set a flag?

Emile van Sebille emile at fenx.com
Fri Feb 4 15:28:37 CET 2011


On 2/4/2011 5:35 AM Bill Felton said...

> Um, not quite correct -- methods *without a specified return value* always return self, that is, the object which executed the method.

Um, no.  They return None.

 >>> class Test:
...   def __init__(self):pass
...   def test(self):pass
...
 >>> a=Test().test()
 >>> a
 >>> print a
None
 >>>

Emile



More information about the Tutor mailing list