Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-07-18 19:58:05


----- Original Message -----
From: <rwgk_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, July 18, 2001 5:57 PM
Subject: [boost] Boost.Python Rich Comparisons

> I have completed the integration of Python 2.1 Rich Comparisons
> into Boost.Python. The documentation is in the boost_python_richcmp
> CVS branch, but can also be viewed at this URL:
>
> http://cci.lbl.gov/~rwgk/shortcuts/boost/libs/python/doc/richcmp.html

Cool! The only thing that's the slightest bit unclear here is whether
NotImplemented is supplied by boost or by the user, and if it's not supplied
by boost, why not?

> Links to three examples are at the bottom of the document.
> See also the (fairly minor) changes to:
>
> http://cci.lbl.gov/~rwgk/shortcuts/boost/libs/python/doc/special.html

example1:

The DVECT_BINARY_OPERATORS macro is a little ugly. Couldn't something be
done with templates and std::less<double>, std::less_equal<double>, etc...?

example2:
Why do you need to tell python explicitly that < <= >= and > are not
implemented with later python versions? It seems as though the fact that
you've defined == and != with this line:

    py_code.def(boost::python::operators<( boost::python::op_eq
                                          | boost::python::op_ne)>());

should be enough.

example3:
Whoa! I'm overwhelmed by the number of macros in this example. Macros aren't
bad in and of themselves, but they're usually better avoided... for so many
reasons... not the least of which is that especially in examples they tend
to obscure what's going on.

-Dave


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