> Okay, but it seems similar logic can be applied to map and > filter, which are higher-order functions.
I have nothing against higher-order functions.
As I thought I explained before, most uses of map() and filter() are easy to understand for non-FP brains, and I don't see anywhere near the same level of abuse as I see for reduce().
> Again, it seems > like such a small thing, to leave reduce in; I can't see > how it affects the rest of the language much - but you > have a much better perspective on that, so I acquiesce.
It's an "attractive nuisance". Having too many builtins makes the language harder to use, so we've been actively looking for builtins to drop.
> FWIW, functools.partial() is cool, but not a very readable > way to mimic reduce's functionality, IMO.
I meant functools.reduce(), which was added to Py3k and will be added to Python 2.6.
Okay then. I wasn't aware of functools.reduce(). Groovy. Thanks. I don't keep up on PEPs usually, so if it's not released, I probably haven't heard of it.
I'm not an expert programmer and I always thought that map(fun,my_list) was the type of function that would internally apply fun to the elements of my_list without guaranteeing the order of application. I even thought that internally the interpreter it could apply the function in parallel and only lock any variables that are shared.
I then thought that this might not be possible because I have already seen some people using:
map(fun, my_list)
expecting the same results as in: for i in my_list: fun(i)
Which is applies fun to each element of my_list in the order of the elements in the list.
So I thought that it would be really nice if this parallelism under the hood only happens when doing:
for i in set(my_list): fun(i)
or map(fun,set(my_list))
Since it's explicit and understood that set doesn't respect the order of the list. However set() also removes duplicates.
So the questions are: 1- Is there any data structure that doesn't guarantee order preservation but allows duplicates? 2- Is it possible with simple syntax to make multi threaded parts of code in an almost transparent way? 3- Are these planned for Python 3000 or maybe 5000?
Maybe I'm completely off topic here, but who knows.
i have question which maybe out of the subject, am new to programming and i have read alot about python,
now the question is if i want to be a good programmer, will learning python alone will be sufficient, or do i have to bother with C, C++, assembly etc.
thanks in advance
PS: am planning to learn programming to do some database programming plus 3d software plugins.
Flat View: This topic has 18 replies
on 2 pages
[
«
|
12
]