On 11/29/2009 8:59 PM, spir wrote:
Lie Ryan<lie.1...@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.
I guess this particular "advice" comes from languages like C/C++ where
returning a struct means copying the whole struct, which could be a very
expensive. In python, returning tuple is cheap; it's just copying
references. Don't hesitate to return multiple values, whenever it is
meaningful/useful (either tuple or list or dict or ...).
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor