Boost logo

Boost :

From: Ralf W. Grosse-Kunstleve (rwgk_at_[hidden])
Date: 2001-08-16 14:33:00


> What's going on with this? Any other name besides 'print' works fine
> here. Is this because the Order::print method (which I am not
> exposing to python) is somehow clashing??

"print" is a reserved Python keyword and cannot be used as an identifier
for function names, including method names.

I could not read the attachment with the compiler error messages.
In general, it is possible to expose functions with optional
arguments. However, the default arguments are lost at the Python
level. Therefore I usually define *free* C++ functions, e.g.:

  bool SgOps_isValidPhase_rad_2(const SgOps& sgo,
                                const Miller::Index& H, double phi) {
    return sgo.isValidPhase_rad(H, phi);
  }
  bool SgOps_isValidPhase_rad_3(const SgOps& sgo,
                                const Miller::Index& H, double phi,
                                double tolerance) {
    return sgo.isValidPhase_rad(H, phi, tolerance);
  }

The Python bindings are defined as:

    py_SgOps.def(SgOps_isValidPhase_rad_2, "isValidPhase_rad");
    py_SgOps.def(SgOps_isValidPhase_rad_3, "isValidPhase_rad");
    py_SgOps.def(&SgOps::epsilon, "epsilon");

This third binding is just to show the difference to "normal"
bindings.

Ralf

P.S.: Improvements have been discussed but are not implemented:
    http://groups.yahoo.com/group/boost/message/14782
    http://groups.yahoo.com/group/boost/message/14789

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk