Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #6917

Multiprocessing.connection magic

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <cpopa@bitdefender.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.022
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; '3.2': 0.05; 'bits': 0.07; 'python': 0.08; '>>>': 0.12; 'server,': 0.12; 'library': 0.15; 'dst)': 0.16; 'guys,': 0.16; 'shutil': 0.16; 'stumbled': 0.16; 'skip:m 30': 0.21; 'directory.': 0.23; 'function': 0.25; 'mode': 0.29; 'import': 0.29; 'charset:iso-8859-15': 0.30; 'module': 0.30; 'sort': 0.31; 'does': 0.33; 'to:addr:python-list': 0.33; "i've": 0.33; '2.6': 0.35; 'using': 0.35; 'data': 0.38; 'some': 0.38; 'doing': 0.39; 'client': 0.39; 'to:addr:python.org': 0.39; 'help': 0.40; 'destination': 0.67; 'received:(helo localhost)': 0.73; 'subject:magic': 0.84; 'subject:skip:M 20': 0.84; 'received:ro': 0.93
Date Fri, 3 Jun 2011 09:28:22 +0300
From Claudiu Popa <cpopa@bitdefender.com>
X-Priority 3 (Normal)
To python-list@python.org
Subject Multiprocessing.connection magic
MIME-Version 1.0
Content-Type text/plain; charset=iso-8859-15
Content-Transfer-Encoding quoted-printable
X-BitDefender-Spam No (0)
X-BitDefender-SpamStamp v1, build 2.8.97.155042, SQMD Hits: InvalidIPBytes34 97.47.107.113, rbl score: 0(0), bayes score: 500(0), pbayes score: 500(0), neunet score: 0(0), flags: [NN_LEGIT_BITDEFENDER; NN_LEGIT_MAILING_LIST_TO], SQMD: 771439a8a29af73898a5080c662be046.fuzzy.fzrbl.org, total: 0(775)
X-BitDefender-Scanner Clean, Agent: BitDefender qmail 3.1.0 on elfie.dsd.hq, sigver: 7.37680
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2417.1307082948.9059.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 82.94.164.166
X-Trace 1307082948 news.xs4all.nl 49042 [::ffff:82.94.164.166]:45881
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:6917

Show key headers only | View raw


Hello guys,
      While  working  at a dispatcher using
  multiprocessing.connection.Listener  module  I've stumbled upon some
  sort    of  magic  trick  that  amazed  me. How is this possible and
  what  does  multiprocessing  library doing in background for this to
  work?

  Client, Python 2.6


  >>> from multiprocessing.connection import Client
  >>> client = Client(("localhost", 8080))
  >>> import shutil
  >>> client.send(shutil.copy)

  Server, 3.2
  >>> from multiprocessing.connection import Listener
  >>> listener = Listener(("localhost", 8080))
  >>> con = listener.accept()
  >>> data = con.recv()
  >>> data
  <function copy at 0x024611E0>
  >>> help(data)
  Help on function copy in module shutil:

  copy(src, dst)
      Copy data and mode bits ("cp src dst").
    
          The destination may be a directory.

  >>>
  

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Multiprocessing.connection magic Claudiu Popa <cpopa@bitdefender.com> - 2011-06-03 09:28 +0300
  Re: Multiprocessing.connection magic Chris Torek <nospam@torek.net> - 2011-06-03 07:03 +0000
    Re: Multiprocessing.connection magic Chris Angelico <rosuav@gmail.com> - 2011-06-03 17:18 +1000
  Re: Multiprocessing.connection magic Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-06-03 10:03 +0200
    Re: Multiprocessing.connection magic Chris Angelico <rosuav@gmail.com> - 2011-06-03 18:26 +1000
      Re: Multiprocessing.connection magic Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-03 08:50 +0000
        Re: Multiprocessing.connection magic Chris Angelico <rosuav@gmail.com> - 2011-06-03 20:34 +1000

csiph-web