Python Forum
Mixed types of numeric data in the statistics module
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mixed types of numeric data in the statistics module
#3
Thanks for the feedback, and sorry for the delay in responding.

(May-16-2022, 07:45 AM)Gribouillis Wrote: The «result is not guaranteed» part worries me. It means that the occasional user has a certain probability to get a wrong result because they introduced some inhomogeneity in the data.

The numeric value of the result should be correct (to the limitations of the data types involved) or else it would count as a bug. It is only the output type of the result which may be surprising, if you mix input types. So if you have a mix of float, Fraction, Decimal, subclasses of each, etc, you may not be able to easily guess the output type. But the output value should be the same regardless.

The statistics module doesn't actually document the rule it uses to work out the "best" output type, but it is complicated and requires a lot of work. (Possibly more work than actually computing the numeric value!) I hope that, by simplifying that rule, I can speed up the statistics functions. But that may mean that computations which today return one type may return a different type in the future.

Technically that is not documented behaviour, but I need to get an estimate of how many people are relying on the current behaviour and will notice the change.
Reply


Messages In This Thread
RE: Mixed types of numeric data in the statistics module - by stevendaprano - May-23-2022, 02:15 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  numeric string sort Skaperen 6 4,102 Jan-23-2018, 08:52 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020