I have a list built from a string split operation, and I wanted to input it to map() function, then strip these substrings from their trailing parenthesis and spaces. And rebuild a list from them.
teststring=" (A) / (B) "
result = list(map(str.strip, teststring.split("/"), " ()"))
But in the end, I only strip oddly the substrings, while "all combinations are tested", as stated by docs.
I know another method is available with list comprehension:
result = [substr.strip(' ()' for substr in teststring.split("/")]
which works.. But I wonder why map doesn't work correctly.
I am on python 3.6.4, with Anaconda 4.4 on windows64.
Subsidiary question; the following topic gives some pointers to find source code of functions. But I could not find the code for map (and generally, for builtin functions), so I could not see if there were bugs into it...