[Python-ideas] Vectorization [was Re: Add list.join() please]

Brendan Barnwell brenbarn at brenbarn.net
Sat Feb 2 15:44:29 EST 2019


On 2019-02-02 12:31, David Mertz wrote:
> I still haven't seen any examples that aren't already spelled 'map(fun, it)'

	The problem with this is the same problem with having a function called 
"add" instead of an operator.  There is little gain when you're applying 
ONE function, but if you're applying multiple functions you get a 
thicket of parentheses.  I would rather see this:

	some_list @ str.lower @ tokenize @ remove_stopwords

. . .than this:

	map(remove_stopwords, map(tokenize, map(str.lower, some_list)))

	That said, I don't necessarily think this needs to be added to the 
language.  Things like pandas already provide this and so much more that 
it's unclear whether the gain from adding vectorization on its own would 
be worth it.

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is no 
path, and leave a trail."
    --author unknown


More information about the Python-ideas mailing list