[Tutor] best practice: throw exception or set a flag?
Alex Hall
mehgcap at gmail.com
Fri Feb 4 17:56:50 CET 2011
On 2/4/11, Bill Felton <subscriptions at cagttraining.com> wrote:
> Um, yes, emphatically yes. You missed the context, which was Smalltalk, and
> it is terms of Smalltalk that my reply is couched.
> Yes, Python returns None.
> Smalltalk returns self by default.
> Given the dropped context, you are correct.
> Given the context meant, I am.
I was following this until now... what is this smalltalk and drop?
>
> regards,
> Bill
>
> On Feb 4, 2011, at 9:28 AM, Emile van Sebille wrote:
>
>> 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
>>
>> _______________________________________________
>> Tutor maillist - Tutor at python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
--
Have a great day,
Alex (msg sent from GMail website)
mehgcap at gmail.com; http://www.facebook.com/mehgcap
More information about the Tutor
mailing list