<div dir="ltr">Hi Luc,<div><br></div><div>Actually it almost works, because Refinery should not inherit from normal_eqns.non_linear_ls, only the adapter, AdaptLstbx. So I can do:</div><div><br></div><div><div>import abc</div>
<div>from scitbx.lstbx import normal_eqns</div><div><br></div><div>class Refinery(object):</div><div> __metaclass__ = abc.ABCMeta</div><div> pass</div><div><br></div></div><div>class AdaptLstbx(Refinery, normal_eqns.non_linear_ls):</div>
<div> class __metaclass__(normal_eqns.non_linear_ls.__class__, abc.ABCMeta): pass</div><div> pass</div><div><br></div><div>This successfully stops Refinery being constructed. However, you do point out the critical flaw, which is that AdaptLstbx can now be constructed, yet this still lacks the missing 'run' method, which would be supplied another child. Now the original raise NotImplementedError() seems like the clearest solution. I suppose this is why people on the internet argue that abc isn't pythonic.</div>
<div><br></div><div>Cheers</div></div><div class="gmail_extra"><br clear="all"><div>-- David<br></div>
<br><br><div class="gmail_quote">On 9 January 2014 00:48, Luc Bourhis <span dir="ltr"><<a href="mailto:luc_j_bourhis@mac.com" target="_blank">luc_j_bourhis@mac.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">> import abc<br>
> from scitbx.lstbx import normal_eqns<br>
> class Refinery(object):<br>
> class __metaclass__(normal_eqns.non_linear_ls.__class__, abc.ABCMeta): pass<br>
><br>
> class AdaptLstbx(Refinery, normal_eqns.non_linear_ls): pass<br>
<br>
</div>Except that it does not prevent<br>
r = Refinery()<br>
after all since the __metaclass__ has a valid instantiation through normal_eqns.non_linear_ls.__class__.<br>
<br>
which gives me a flashback: I've already burnt myself with that!<br>
<div class="HOEnZb"><div class="h5"><br>
Luc<br>
<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>
</div></div></blockquote></div><br></div>