On Dec 26, 2019, at 05:54, Kemal Diri <kemal.d...@sewan.fr> 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).
You don’t need a third party library like numpy; you can use stats in the stdlib. And the question is not whether avg is useful, but whether it’s useful so often that it deserves to be in the very limited set of builtins. I’m pretty sure I use math.sin, json.loads, itertools.count, and functools.partial more often than I use stats.mean. And I use other functions from stats, like stdev, almost as often as I use mean. Maybe the answer to this question is yes. Maybe novices need to be able to average things before they even learn about import. Maybe there’s some class of programs where mean really is super important but you don’t need anything else from stats (or numpy). Whatever. But you have to make that argument; otherwise, stats.mean seems like the right place for it, just like functools.partial and math.sin.
_______________________________________________ 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/G5UGW5XT5GDOE4JOXANQ6WDVF4BHOY6X/ Code of Conduct: http://python.org/psf/codeofconduct/