[Python-ideas] values in vs. values out

Daniel da Silva ddasilva at umd.edu
Thu Jan 13 16:50:22 CET 2011


If the return value is an instance of a class, then to extend the return
value you just add a new instance attribute to the class. If a class feels
too heavy duty, use a single named tuple and access its elements with dot
notation.

Either method is guaranteed not to break until you remove an instance
attribute or element, at which point it doesn't make sense to do anything
else.




On Thu, Jan 13, 2011 at 10:33 AM, Eric Smith <eric at trueblade.com> wrote:

> On 01/13/2011 10:21 AM, Luc Goossens wrote:
>
>> Hi Eric (and Rob, and Ben, ...),
>>
>> Sorry maybe this was not clear from my mail but I am not so much
>> interested in possible work-arounds but in why this asymmetry exists in
>> the first place.
>> I mean is there a reason as to why it is the way it is, or is it just
>> that nobody ever asked for anything else.
>>
>
> If the system automatically ignored "new" return values (for whatever "new"
> might mean), I think it would be too easy to miss return values that you
> don't mean to be ignoring.
>
>
> Eric.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110113/8f76d918/attachment.html>


More information about the Python-ideas mailing list