Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6920
| References | <mailman.2417.1307082948.9059.python-list@python.org> <isa10n02ifb@news3.newsguy.com> |
|---|---|
| Date | 2011-06-03 17:18 +1000 |
| Subject | Re: Multiprocessing.connection magic |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2419.1307085526.9059.python-list@python.org> (permalink) |
On Fri, Jun 3, 2011 at 5:03 PM, Chris Torek <nospam@torek.net> wrote: > The real magic is in the unpickler, which has figured out how to > access shutil.copy without importing shutil into the global namespace: So from this I gather that it doesn't actually pickle the code, just the name. Seems a little odd, but that would explain why this didn't really work: >>> def asdf(x): x.append(len(x)) return len(x) >>> pickle.dumps(asdf) b'\x80\x03c__main__\nasdf\nq\x00.' >>> asdf=pickle.dumps(asdf) >>> pickle.loads(asdf) b'\x80\x03c__main__\nasdf\nq\x00.' >>> asdf b'\x80\x03c__main__\nasdf\nq\x00.' I tried to do the classic - encode something, discard the original, attempt to decode. Didn't work. Chris Angelico
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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