Encapsulation, inheritance and polymorphism

Robert Miles robertmiles at teranews.com
Sun Aug 19 01:21:48 EDT 2012


On 7/23/2012 11:18 AM, Albert van der Horst wrote:
> In article <5006b48a$0$29978$c3e8da3$5496439d at news.astraweb.com>,
> Steven D'Aprano  <steve+comp.lang.python at pearwood.info> wrote:
> <SNIP.
>> Even with a break, why bother continuing through the body of the function
>> when you already have the result? When your calculation is done, it's
>> done, just return for goodness sake. You wouldn't write a search that
>> keeps going after you've found the value that you want, out of some
>> misplaced sense that you have to look at every value. Why write code with
>> unnecessary guard values and temporary variables out of a misplaced sense
>> that functions must only have one exit?
>
> Example from recipee's:
>
> Stirr until the egg white is stiff.
>
> Alternative:
> Stirr egg white for half an hour,
> but if the egg white is stiff keep your spoon still.
>
> (Cooking is not my field of expertise, so the wording may
> not be quite appropriate. )
>
>> --
>> Steven
>
> Groetjes Albert

Note that you forgot applying enough heat to do the cooking.





More information about the Python-list mailing list