Hi Ralf,<div><br></div><div>Thanks for the explanation. it&#39;s good to know what I shouldn&#39;t try to solve a problem, as I now feel more freely able to get on with solving it :) In this case the extra overhead of creating scitbx.matrix entities from the returned tuples will disappear with time, as more code gets moved to C++. So I must keep in mind not to worry about performance at the Python level.</div>

<div><br></div><div>I have a better feel for the type mappings now I think. Tuple as a common type for all sequence-type objects makes sense in Python, and as long as I can expect to get tuples back I can avoid any nasty surprises.</div>

<div><br></div><div>-- David<br>
<br><br><div class="gmail_quote">On 14 May 2012 15:15, Ralf Grosse-Kunstleve <span dir="ltr">&lt;<a href="mailto:rwgrosse-kunstleve@lbl.gov" target="_blank">rwgrosse-kunstleve@lbl.gov</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi David,<div><br></div><div><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>When I access the attribute in Python with the usual dot operator I get a tuple. What I&#39;d really like though is an object of type�&lt;class &#39;scitbx.matrix.col&#39;&gt;, which is what I passed to the constructor of the object in Python.</div>


</blockquote><div><br></div></div><div>This would be nice indeed but is a little tricky to implement. The C++ wrapper code would need to import scitbx.matrix. It&#39;s entirely possible but I always shied away from introducing this dependency.</div>

<div class="im">
<div>�</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>I found I had to add</div><div><br></div><div>from cctbx.array_family import flex</div><div><br></div>


<div>to the package __init__.py where my C++ extension is imported,</div></blockquote><div><br></div></div><div>This import piggy-backs a whole bunch of loosely related from-and-to-tuple conversions; see scitbx/array_family/boost_python/flex_ext.cpp. I had long discussions with Luc about this when he started using cctbx, because from a purists standpoint centralizing all the conversions in flex_ext.cpp breaks modularity. However, the discussions didn&#39;t lead to practical alternatives, and I believe the current solution works well in practice.</div>

<span class="HOEnZb"><font color="#888888">
<div><br></div><div>Ralf</div><div><br></div></font></span></div></div>
<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>
<br></blockquote></div><br></div>