[Python-ideas] Re: argmax and argmin to python list

2020-08-30 Thread Filipp Bakanov
cott wrote: > > > On 30 Aug 2020, at 09:03, Jeff Allen wrote: > > On 29/08/2020 14:17, Barry Scott wrote: > > On 29 Aug 2020, at 13:42, Filipp Bakanov wrote: > > I'd like to propose adding argmax and argmin functions to the python list. > These functions return t

[Python-ideas] argmax and argmin to python list

2020-08-29 Thread Filipp Bakanov
I'd like to propose adding argmax and argmin functions to the python list. These functions return the index of a maximum / minimum element of the list. Eg: a = [1, 4, 2, 3] print(a.argmax()) # 1 print(a.argmin()) # 0 It's a very popular request (based on stackoverflow https://stackoverflow.com/

Re: [Python-ideas] Add "equal" builtin function

2016-10-06 Thread Filipp Bakanov
Seems like itertools recipes already have "all_equal" function. What do you think about moving it from recipes to itertools? I suggest a C implementation with optimisations for builtin collections. 2016-10-06 18:42 GMT+03:00 Chris Angelico : > On Fri, Oct 7, 2016 at 2:23 AM, Steven D'Aprano > wr

[Python-ideas] Add "equal" builtin function

2016-10-06 Thread Filipp Bakanov
For now there are many usefull builtin functions like "any", "all", etc. I'd like to propose a new builtin function "equal". It should accept iterable, and return True if all items in iterable are the same or iterable is emty. That's quite popular problem, there is a discussion of how to perform it