[Tutor] Python best practices

spir denis.spir at free.fr
Sun Nov 29 10:59:01 CET 2009

Lie Ryan <lie.1296 at gmail.com> dixit:

> > - functions should return one value (im not 100% of this one)  
> I 100% disagree or with this one.

Could you explain this bit, Lie? I'm very interested.
I use multiple-value result myself, for it's so practicle in given cases. But it makes me uneasy; also have the impression (why?) it reveals wrong design.

About the same feeling as when I need a function both to have an effect (eg assignment outside the func scope) and return a value. I call this "action vs question" ; it more or less matches Bertrand Meyer's "Command-Query Separation Principle" (Eiffel) & Pascal "procedure vs function".
In the latter case I'm 99% sure the design smells but sometines I cannot find proper code reorganisation.


la vita e estrany


More information about the Tutor mailing list