[sugar] python activities startup
Benjamin M. Schwartz
bmschwar
Wed Feb 6 09:59:16 EST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Tomeu Vizoso wrote:
> If I understand correctly how that fork() would work, what we would be
> saving in that case is the reading of modules, but the python code at
> the module scope would need to be executed anyway.
I am no expert, but, without evidence, my current suspicion is the other way.
Consider:
import dbus
import os
def launch_activity(some_activity)
if os.fork() == 0:
import some_activity
x = some_activity.SomeActivity()
else:
return
- From the perspective of the child process, the modules have already been
imported, and are even still in scope. It would be strange for the Python
semantics if the imports were somehow "forgotten" in the child.
- --Ben
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHqctEUJT6e6HFtqQRAnuJAKCERl12jDpsYovWMEoCTKmea1NvLgCfdXOg
wBt9No0/TmALQ/k3AHxdgyg=
=13qT
-----END PGP SIGNATURE-----
More information about the Sugar-devel
mailing list