[SciPy-Dev] return named tuples

Clark Fitzgerald clarkfitzg at gmail.com
Fri Sep 12 17:28:31 EDT 2014


PR open for this now: https://github.com/scipy/scipy/pull/3991

I made them private using the naming convention `_funcname_out` and put
them in the same module, directly above the function where they will be
used.

Clark

On Tue, Sep 9, 2014 at 10:53 AM, Ralf Gommers <ralf.gommers at gmail.com>
wrote:

>
>
> On Tue, Sep 9, 2014 at 6:16 PM, Daniel da Silva <mail at danieldasilva.org>
> wrote:
>
>> Are the namedtuple subclasses used to create return values going to be
>> made available? If so, what's the convention on where they will be placed?
>>
>
> They should remain private I'd think.
>
>
>
>>
>>
>>>>> Sounds good to me.  This could eventually be applied to many
>>>>> functions in scipy.
>>>>>
>>>>> Before adding this feature to a function, look for any related
>>>>> functions that might return similar values.   We should try to
>>>>> ensure that return values with the same meaning are consistently
>>>>> given the same name.  We should avoid, for example, one statistical
>>>>> test using "p", another using "pvalue" and third using "p_value".
>>>>>
>>>>> We'll also need to update our docstring standard to include guidelines
>>>>> for documenting such return values.
>>>>>
>>>>
>>>> It's nice for users, but doesn't help for developing the code.
>>>>
>>>> It's backwards compatible but not "future proof".
>>>> For example it's a pain that we cannot change the returns of linregress
>>>> to add some additional things because it would break the behavior as a
>>>> tuple.
>>>>
>>>
> True, but an orthogonal discussion. We may decide to break backwards
> compat on a case by case basis, but there would have to be very good
> reasons to do so. Using namedtuples is a straightforward improvement
>
> Ralf
>
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20140912/70e64a3c/attachment.html>


More information about the SciPy-Dev mailing list