parallel computing

Discussion in 'Python' started by Sori Schwimmer, Apr 25, 2006.

  1. 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
     
    Sori Schwimmer, Apr 25, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page