RFC: startup time - again

John Arbash Meinel john at arbash-meinel.com
Tue Sep 9 19:25:00 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matt Nordhoff wrote:
...

>> There are some other, mostly minor, things.
> 
> That's no longer the case. Nowadays, they override the __import__
> function, so there's no special syntax whatsoever, and everything gets
> imported lazily (except for half a dozen modules on an ignore list).
> 
> (Look at mercurial/demandimport.py [1] in the source tree if you're
> curious. It replaced the old mercurial/demandload.py in version 0.9.4.)
> 
Interesting, as that tends to break 3rd party code. Which is why we
chose not to do it. Especially optional imports like:

try:
  import foo
except ImportError:
  # use different functionality

I would guess they did it because some of the standard library is also
pretty bad about import ordering. Witness our workaround for 'copy'
called 'inspect_for_copy'. Where we create a custom 'inspect' module for
the 'copy' module because it doesn't use 90% of the functionality that
gets loaded.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjGv3wACgkQJdeBCYSNAAPgmACeIrvnHHKSTXmeUNc1RChWBOmW
KFYAn1xBQY9IVX6OqJiSHCGejiBGoQqP
=SmDl
-----END PGP SIGNATURE-----



More information about the bazaar mailing list