[cctbxbb] boost python and metaclass inheritance

Luc Bourhis luc_j_bourhis at mac.com
Wed Jan 8 16:48:26 PST 2014


> import abc
> from scitbx.lstbx import normal_eqns
> class Refinery(object):
>  class __metaclass__(normal_eqns.non_linear_ls.__class__, abc.ABCMeta): pass
> 
> class AdaptLstbx(Refinery, normal_eqns.non_linear_ls): pass

Except that it does not prevent
  r = Refinery()
after all since the __metaclass__ has a valid instantiation through normal_eqns.non_linear_ls.__class__.

which gives me a flashback: I've already burnt myself with that!

Luc



More information about the cctbxbb mailing list