The Artima Developer Community
Sponsored Link

Weblogs Forum
Python 3000 FAQ

18 replies on 2 pages. Most recent reply: May 17, 2008 12:53 PM by mishari A.A

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 18 replies on 2 pages [ « | 1 2 ]
Guido van van Rossum

Posts: 359
Nickname: guido
Registered: Apr, 2003

Re: Python 3000 FAQ Posted: Aug 6, 2007 2:26 PM
Reply to this message Reply
Advertisement
> 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.

Chuck Allison

Posts: 63
Nickname: cda
Registered: Feb, 2003

Re: Python 3000 FAQ Posted: Aug 6, 2007 2:32 PM
Reply to this message Reply
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.

ricard marxer

Posts: 1
Nickname: rikrd
Registered: Aug, 2007

Re: Python 3000 FAQ Posted: Aug 9, 2007 2:16 AM
Reply to this message Reply
About Multiprocessors, map() and reduce()...

I have a naive doubt about a this type of stuff.

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.

mishari A.A

Posts: 1
Nickname: mishari
Registered: May, 2008

Re: Python 3000 FAQ Posted: May 17, 2008 12:53 PM
Reply to this message Reply
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 [ « | 1  2 ]
Topic: Python 3000 FAQ Previous Topic   Next Topic Topic: RSS: The Wrong Solution to a Broken Internet

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use