<br clear="all"><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse;color:rgb(34,34,34)"><p><font face="arial, helvetica, sans-serif">Claudia Millán (<a href="mailto:cmncri@ibmb.csic.es" style="color:rgb(17,85,204)" target="_blank">cmncri@ibmb.csic.es</a>)</font></p>
<p><font face="arial, helvetica, sans-serif">Institut de Biologia Molecular de Barcelona (IBMB-CSIC)</font></p><p><font face="arial, helvetica, sans-serif">Barcelona, Spain</font></p></span>Ok, thanks a lot for the suggestions. I also realised i was having some problems with the PYTHONPATH and then other issues stop to arise. Thanks again for a quick reply :)<div>
<div><br></div><div>Cheers,</div><div><br></div><div>Claudia<br>
<br><br><div class="gmail_quote">2012/10/1 Nathaniel Echols <span dir="ltr"><<a href="mailto:nechols@lbl.gov" target="_blank">nechols@lbl.gov</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Mon, Oct 1, 2012 at 3:29 AM, Claudia Millán Nebot<br>
<<a href="mailto:cmncri@ibmb.csic.es">cmncri@ibmb.csic.es</a>> wrote:<br>
> I've just started to look into the cctbx facilities, and as i'm a newbie in<br>
> both object oriented programming and in general to the system, i'm tryng to<br>
> play around and find by myself how things are working. Using the<br>
> cctbx.python, i realised that it is necessary to import explicitly the<br>
> module amino_acid_codes, while for others like atom_name_interpretation this<br>
> is done straigthforward if you do an import from a lower level (like from<br>
> iotbx.pdb import *). Is there some good reason because this has to be like<br>
> that?<br>
<br>
</div>I suspect this is a Python quirk - atom_name_interpretation is<br>
imported at the top of iotbx/pdb/__init__.py, amino_acid_codes is not.<br>
In general, however, I would recommend two rules for dealing with<br>
imports:<br>
<br>
1. Always explicitly import any module you want - with the exception<br>
that if you do this:<br>
import iotbx.pdb.amino_acid_codes<br>
you will also have access to iotbx.pdb as well. In this case you<br>
might want to do this:<br>
from iotbx.pdb import amino_acid_codes, atom_name_interpretation<br>
the choice of when to use "from foo import bar" versus "import<br>
foo.bar" is up to you, but the latter is a better idea if there is any<br>
ambiguity in the names of submodules (for instance, anything named<br>
"utils", of which there are probably a half-dozen).<br>
<br>
2. Never use "from foo import *" - it's just a bad idea, because<br>
anyone else looking at the code won't be able to tell where a function<br>
comes from. (Actually, we use this frequently for Boost.Python<br>
extensions, but we shouldn't.)<br>
<br>
-Nat<br>
_______________________________________________<br>
cctbxbb mailing list<br>
<a href="mailto:cctbxbb@phenix-online.org">cctbxbb@phenix-online.org</a><br>
<a href="http://phenix-online.org/mailman/listinfo/cctbxbb" target="_blank">http://phenix-online.org/mailman/listinfo/cctbxbb</a><br>
</blockquote></div><br></div></div>