[cctbxbb] from __future__ import division has become compulsory

Luc Bourhis luc_j_bourhis at mac.com
Wed Aug 15 01:56:24 PDT 2012


Dear cctbx developers,

as discussed here a few days ago, it has been decided that every single Python module must feature
from __future__ import division
A mega commit of mine has just taken care of existing code. For future modules, libtbx.find_clutter will complain if that line is missing. A script libtbx.add_from_future_import_division is provided that can add that line correctly.

The rationale is that:
i. as you know, we want to use the so-called new division semantics in cctbx modules (i.e. 1/2 == 0.5 instead of 1/2 == 0 as per the old semantics for the record)
ii. the current solution passing -Qnew on the Python command line in the dispatchers libtbx.python, cctbx.python, etc is not always appropriate as there are people out there using cctbx as yet-another-library in a context where some code would not correctly run with the new division semantics, therefore barring the use of -Qnew

The only solution to reconcile i. and ii. is therefore to add that __future__ line in every single Python module committed to the cctbx.

Note however that the aforementioned dispatchers do still use -Qnew so that Phenix developers do not need to put that very line in their Phenix code.

Hopefully, we can make everybody reasonably happy with those compromises.

Best wishes,

Luc



More information about the cctbxbb mailing list