[Python-ideas] Re: AVG Function as Built-in

2019-12-29 Thread Steven D'Aprano
On Thu, Dec 26, 2019 at 05:51:09PM -, Marco Sulla via Python-ideas wrote: > Stephen J. Turnbull wrote: > > > from statistics import mean > > > sum([1e16,1,1])/3 == 1e16/3# surprise! > > > True > > > mean([1e16,1,1]) == 1e16/3 > > > False > > > Regards, > > Python 3.9.0a0

[Python-ideas] Re: AVG Function as Built-in

2019-12-26 Thread Todd
(even it costs >nothing) so I won't consume a line. > > > Cordialement/Regards > Kemal DIRI > > > > > -- > *De :* Sebastian Kreft > *Envoyé :* jeudi 26 décembre 2019 15:07 > *À :* Kemal Diri > *Cc :* python-ideas@python.org ; &

[Python-ideas] Re: AVG Function as Built-in

2019-12-26 Thread Marco Sulla via Python-ideas
Stephen J. Turnbull wrote: > > from statistics import mean > > sum([1e16,1,1])/3 == 1e16/3# surprise! > > True > > mean([1e16,1,1]) == 1e16/3 > > False > > Regards, Python 3.9.0a0 (heads/master-dirty:d8ca2354ed, Oct 30 2019, 20:25:01) [GCC 9.2.1 20190909] on linux Type "help",

[Python-ideas] Re: AVG Function as Built-in

2019-12-26 Thread Marco Sulla via Python-ideas
So why only mean and not median, that's better for statistics? :D Seriously, if you want it builtin, add it to PYTHONSTARTUP: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONSTARTUP from statistics import mean ___ Python-ideas mailing

[Python-ideas] Re: AVG Function as Built-in

2019-12-26 Thread Todd
The Python standard library module 'statistics' has a "mean" function. On Thu, Dec 26, 2019, 08:54 Kemal Diri wrote: > Hello, > > I think it would be nice to introduce an avg method for lists as a > built-in function in python3. > To get average of the list, I need to use some libs (eg numpy).

[Python-ideas] Re: AVG Function as Built-in

2019-12-26 Thread Kemal Diri
; kemald...@gmail.com Objet : Re: [Python-ideas] AVG Function as Built-in Just use `from statistics import mean as avg` (see https://docs.python.org/3/library/statistics.html#statistics.mean). Please provide some justification on why do you think it's desirable to make `avg` a builtin, considering

[Python-ideas] Re: AVG Function as Built-in

2019-12-26 Thread Sebastian Kreft
Just use `from statistics import mean as avg` (see https://docs.python.org/3/library/statistics.html#statistics.mean). Please provide some justification on why do you think it's desirable to make `avg` a builtin, considering, that doing so is a backwards incompatible change due to the more than