Dear Python documentation team, on page http://docs.python.org/library/multiprocessing.html in chapter "16.6.1.1. The Process class" there is a obvious typo inside the second code example in line 7 from multiprocessing import Process import os def info(title): print title print 'module name:', __name__ print 'parent process:', os.getppid() <-- it means os.getpid() print 'process id:', os.getpid() def f(name): info('function f') print 'hello', name if __name__ == '__main__': info('main line') p = Process(target=f, args=('bob',)) p.start() p.join() Best wishes from Germany Enjoy the weekend Sebastian -- ------------------------------------------------------------- Dipl. Ing. Sebastian Zug Dept. Embedded Systems and Operating Systems (EOS) Institute for Distributed Systems (IVS) Otto-von-Guericke-University of Magdeburg Universitätsplatz 2 39106 Magdeburg Germany mail: zug@ivs.cs.uni-magdeburg.de Tel.: +49 - 391 - 67 - 11459 Fax: +49 - 391 - 67 - 11161
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 30.10.2010 18:29, schrieb Sebastian Zug:
Dear Python documentation team,
on page
http://docs.python.org/library/multiprocessing.html
in chapter "16.6.1.1. The Process class" there is a obvious typo inside the second code example in line 7
from multiprocessing import Process import os
def info(title): print title print 'module name:', __name__ print 'parent process:', os.getppid() <-- it means os.getpid()
I think this is correct -- getpid() is called in the next line. os.getppid() does exist and returns the parent process ID.
print 'process id:', os.getpid()
def f(name): info('function f') print 'hello', name
if __name__ == '__main__': info('main line') p = Process(target=f, args=('bob',)) p.start() p.join()
Best wishes from Germany
Best wishes back, Georg -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) iEYEARECAAYFAkzOso0ACgkQN9GcIYhpnLAMQwCgkoQEmAGGd7ff2veIg1oQzwlg L4EAnAvxv1AXD6i1ghSuuKL5e7lu2ox0 =q5gc -----END PGP SIGNATURE-----
participants (2)
-
Georg Brandl
-
Sebastian Zug