[Numpy-discussion] deprecating float(x) for ndim > 0

Nico Schlömer nico.schloemer at gmail.com
Thu Sep 16 02:16:52 EDT 2021


@george trojan

The SciPy devs are very careful not to break backwards compatibility,
even if the changes are arguably useful. That's why the impact of the
numpy PR remains under the hood for SciPy users.
I'd love to see SciPy become more consistent with array
dimensionality, too, but that's a different issue.

On Wed, Sep 15, 2021 at 11:59 PM Andrew Nelson <andyfaff at gmail.com> wrote:
>
>
>
> On Thu, 16 Sep 2021, 03:25 george trojan, <george.trojan at gmail.com> wrote:
>>
>>
>> I just wrote the following code:
>>
>> twb = scipy.optimize.fsolve(phi, tdb, args=(tdb, p, w, hd_tdb, hg_tdb), xtol=1e-8)
>> tdb, p, w, hd_tdb, hg_tdb
>> twb.shape
>> print("wet-bulb temperature {:.5f} [deg K]".format(float(twb)))
>>
>> The output is
>>
>> (313.15, 101325.0, 0.009200033532084696, 40182.343155896095, 2573510.322137241)
>>
>> (1,)
>>
>> wet-bulb temperature 295.17583 [deg K]
>>
>> All arguments are floats, the function phi returns float as well. I did expect the output to be float. Instead I got a 1d array. Were my expectations wrong?
>
>
> In the return section for fsolve the documentation states that the return value, `x`, is an `ndarray`.
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion


More information about the NumPy-Discussion mailing list