parallel computing

Sori Schwimmer sxn02 at yahoo.com
Tue Apr 25 15:02:05 EDT 2006


Hi All,

While working on a project, I discovered lots of
little opportunities for real parallelism. For
instance, the following class initialization:

from pg import DB

class example:
  def __init__(self):
    # find somehow HOST1, HOST2
   
self.member1=DB('database1',host=HOST1).query("SELECT...").getresult()
    self.member2=self.my_aux_func()
    # some more processing here
   
self.member3=DB('database1',host=HOST2).query("SELECT...").getresult()
    # other things here

will ask other physical computers to do some of the
work... and wait for the results.

Wouldn't be nice, in the spirit of occam (the
language) to do it like the following?

from pg import DB

class example:
  def __init__(self):
    # find somehow HOST1, HOST2
    par:
     
self.member1=DB('database1',host=HOST1).query("SELECT...").getresult()
      seq:
        self.member2=self.my_aux_func()
        # some more processing here
     
self.member3=DB('database1',host=HOST2).query("SELECT...").getresult()
    # other things here

I know, we have thread(s), but is not the same. Things
built in the language are faster, as they are
C-compiled rather than Python-interpreted. The syntax
is pretty simple and expressive. It simply gives, IMO,
more power to the programmer.

Is it worth for a PEP?

Regards,
Sorin Schwimmer

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Python-list mailing list