[PATCH 2 of 3] absolute imports for mercurial modules

Martin Geisler mg at lazybytes.net
Sun May 3 10:29:12 CDT 2009


Benoit Boissinot <benoit.boissinot at ens-lyon.org> writes:

> On Sun, May 03, 2009 at 12:52:34AM +0200, Martin Geisler wrote:
>> Simon Heimberg <simohe at besonet.ch> writes:
>> 
>> > # HG changeset patch
>> > # User Simon Heimberg <simohe at besonet.ch>
>> > # Date 1240936971 -7200
>> > # Node ID da8bb0eb1d2eaacd838399d98d4e6bc764571685
>> > # Parent  1c64876cb225e06807c7ec9d00d26e08564fccbc
>> > absolute imports for mercurial modules
>> 
>> I personally like this, I think it makes things more explicit. It is
>> also more future-proof than the current relative imports.
>> 
>> Does anybody have anything against the absolute imports?
>
> You should investigate the implication with demandimport, depending on
> how you load modules demandimport might not lazy-load it.

I believe it works just fine:

% python
Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from mercurial import demandimport
>>> demandimport.enable()
>>> import mercurial
>>> mercurial
<unloaded module 'mercurial'>
>>> from mercurial import util
>>> util
<unloaded module 'util'>
>>> util.version
<function version at 0xb7a95a04>
>>> util
<module 'mercurial.util' from '/var/lib/python-support/python2.5/mercurial/util.pyc'>


Matt, do you have any objections?

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090503/fab502ab/attachment.pgp 


More information about the Mercurial-devel mailing list