On 13May2022 00:17, Steven D'Aprano <st...@pearwood.info> 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 type, honouring subclasses: [...] >but that's harder than you might expect and the extra complexity causes >some significant performance costs. And not all combinations are >supported (Decimal is particularly difficult). [...] >Would you be satisfied with a rule that said that the statistics >functions expect homogeneous data and that the result of calling the >functions on mixed types is not guaranteed? As a general purpose programmer, I would be happy with this. Almost certainly happier than accepting mixed data, because I'd be force to consider what I expect to get _back_ from the functions by supplying a consistent thing _to_ them. My statistics knowledge is not much thicker than a veneer telling how to spell "mean" and "median", but in the general case I'd probably prefer: - a rule like the above requiring homogeneous data - some convenience functions to produce homongenous data from mixed data with docstrings detailing how that is done, possibly slightly broken up if that makes it easy for users to do their own convert-to-homogenous operation I'm also attracted to doing "O(n) convert to homogenous" followed by a _fast_ operation than an accept-heterogeneous-but-be-much-slower. Cheers, Cameron Simpson <c...@cskk.id.au> _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/ZNI3O4H4KEUG4SFUWUFFMCIQC6LDW5DT/ Code of Conduct: http://python.org/psf/codeofconduct/