[Python-Dev] Relative import

Nick Coghlan ncoghlan at iinet.net.au
Wed Dec 17 10:22:05 EST 2003


John J Lee wrote:
> I can see that people not knowing how to spell "hierarchy" might be a
> problem here <wink>

Heh, good point. I always get confused by the place of the 'heir' in the 
'hierarchy'. I had a seriously hard time coming up with a one word name 
that suggested the right semantics for that category. If the idea gets 
any interest, it'd be nice to find a better word for that case. I was 
tempted to use __ambiguous__, though :)

Hmm, __scan__ could be an option. The other two are fairly specific 
about where to look, but category 'C' requests a scan of the package 
heirarchy.

A: from __absolute__.dotted.name import foo
B: from __relative__.dotted.name import bar
C: from __scan__.dotted.name import foobar
D: from dotted.name import barfoo

I suspect the 'as' clause would be heavily used with this construct, but 
it wouldn't be compulsory - as far as module referencing in the code 
goes, I don't think there's anything illegal about the special names.

Cheers,
Nick.

-- 
Nick Coghlan               |     Brisbane, Australia
Email: ncoghlan at email.com  | Mobile: +61 409 573 268




More information about the Python-Dev mailing list