[chimera-dev] chimera import

Eric Pettersen pett at cgl.ucsf.edu
Mon Oct 2 10:55:34 PDT 2006


Tom Goddard's comments are exactly correct, I just want to add some  
advice.  If anyone else will be working on your code, you should try  
to avoid the "from module_name import *" construct because it makes  
it more difficult to find the place where a class is defined.  Say  
for example you use a Point object in your code.  A person trying to  
find the definition for Point first has to look through the file  
using Point to see if it's defined there, then through each module  
from which you've imported "*" to look for it.  It is better to  
import just the names you are going to use, something like:  "from  
chimera import Point, openModels, Molecule".  That statement makes it  
clear where the definition of Point is going to be found.

The other thing is that the "chimera" module imports all the names  
from _chimera, so typically you import from chimera rather than  
_chimera.  I know that the chimera uses the "from _chimera import *"  
construct, which seems somewhat hypocritical given the advice above,  
but it is being used to make C++ classes/functions that "logically"  
belong in the chimera module available.

--Eric
                         Eric Pettersen
                         UCSF Computer Graphics Lab
                         pett at cgl.ucsf.edu
                         http://www.cgl.ucsf.edu


On Oct 2, 2006, at 5:44 AM, Javier Díez wrote:

> Hy,
> I've just started working on a Chimera extension.
> I've tried to import chimera after setting up the CHIMERA os  
> variable, but it gives me this erro message:
> from _chimera import *
> ImportError: No module named _chimera
> Some help?
> Thank you.
> Javi
>
> _______________________________________________
> Chimera-dev mailing list
> Chimera-dev at cgl.ucsf.edu
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20061002/886d5501/attachment.html>


More information about the Chimera-dev mailing list