[Chicago] import question

Massimo Di Pierro mdipierro at cs.depaul.edu
Tue Jan 22 23:55:59 CET 2008


>

This does not solve the problem because requires me to edit __init__.py
Moreover other itself imports test.other2 which imports test.other3 etc.
All files assume that that test is installed.

Massimo

> I'm presuming contrib is a package here, ie, that contrib/ 
> __init__.py exists.
> That said, under Python 2.5+, in contrib/test/__init__.py you can  
> write:
>
> from .other import something
>
> That's a relative import, see http://docs.python.org/whatsnew/ 
> pep-328.html
>
> If you're targeting <2.5, you'll need to do one of the alternatives  
> you
> suggested - (1) is clearly better, as you noted.
>
> --
> Peter Fein   ||   773-575-0694   ||   pfein at pobox.com
> http://www.pobox.com/~pfein/   ||   PGP: 0xCCF6AE6B
> irc: pfein at freenode.net   ||   jabber: peter.fein at gmail.com
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago



More information about the Chicago mailing list