[Python-ideas] Heterogeneous numeric data in statistics library

2022-05-12 Thread Steven D'Aprano
Users of the statistics module, how often do you use it with heterogeneous data (mixed numeric types)? Currently most of the functions try hard to honour homogeneous data, e.g. if your data is Decimal or Fraction, you will (usually) get Decimal or Fraction results: >>> statistics.variance([Dec

[Python-ideas] Re: Heterogeneous numeric data in statistics library

2022-05-12 Thread Jonathan Fine
Hi Steve Today's XKCD is on 'Selection Bias' and it is set in a statistics conference: https://xkcd.com/2618/ According to its PEP the statistics module provides "common statistics functions such as mean, median, variance and standard deviation". You ask "if you are a user of statistics, how imp

[Python-ideas] Re: Heterogeneous numeric data in statistics library

2022-05-12 Thread Danilo J. S. Bellini
IMHO, mixing custom types in this context is usually not required, as long as at least int-to-anything-else typecast is possible. Currently it's done only when there is at least one non-int and when the result can't be represented as int, that is: >>> statistics.mean([1, 2, 3, 6]) 3 >>> statistics

[Python-ideas] Re: Heterogeneous numeric data in statistics library

2022-05-12 Thread Chris Angelico
On Fri, 13 May 2022 at 00:20, Steven D'Aprano wrote: > > If you are a user of statistics, how important to you is the ability to > **mix** numeric types, in the same data set? > > Which combinations do you care about? > I'm only a very small-time user of it, but the only combination I use is int

[Python-ideas] Re: Heterogeneous numeric data in statistics library

2022-05-12 Thread Cameron Simpson
On 13May2022 00:17, Steven D'Aprano wrote: >Users of the statistics module, how often do you use it with >heterogeneous data (mixed numeric types)? Disclaimer: I am not yet a user of the statistics module. >With mixed types, the functions usually try to coerce the values into a >sensible common

[Python-ideas] Formatted structural patterns

2022-05-12 Thread Matsuoka Takuo
I would like to propose a new type of pattern for structural pattern matching. A motivation will be described later below. The pattern may be written in a form like {} (with braces), where is either a literal pattern or an identifier (or "NAME" in the structural pattern matching terminology