mirror of
https://github.com/boostorg/python.git
synced 2026-01-20 04:42:28 +00:00
Compare commits
19 Commits
svn-branch
...
svn-branch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6349a3f39f | ||
|
|
b6a9830b9d | ||
|
|
ead8d0aba5 | ||
|
|
7a4b240838 | ||
|
|
f500202dab | ||
|
|
fc3f1bb531 | ||
|
|
5f8f5b4c3e | ||
|
|
303885fefa | ||
|
|
2c1a276671 | ||
|
|
c3d20eb07f | ||
|
|
e32979fe0a | ||
|
|
af8efb72bd | ||
|
|
5792bffaa2 | ||
|
|
e3130fe75b | ||
|
|
ef6194f1f8 | ||
|
|
b262615aa8 | ||
|
|
842cf85d4b | ||
|
|
5daa36d04d | ||
|
|
ba5503cf89 |
@@ -396,27 +396,33 @@
|
||||
</blockquote>
|
||||
</dd>
|
||||
|
||||
<dt><b><a href="http://www.rationaldiscovery.com">Rational Discovery
|
||||
LLC</a></b></dt>
|
||||
<dt><b><a href="http://pyrap.googlecode.com/">Pyrap</a></b></dt>
|
||||
<dd>
|
||||
<p><a href="diepen@astron.nl"
|
||||
>Ger van Diepen</a> writes:</p>
|
||||
|
||||
<blockquote>
|
||||
<p>Pyrap is the python interface to the Radio-Astronomical Package
|
||||
casacore (<a href="http://casacore.googlecode.com/"
|
||||
>casacore.googlecode.com</a>). Astronomers love pyrap because
|
||||
it makes it easily possible to get their data (observed with
|
||||
radio-astronomical telescopes like LOFAR, ASKAP, and eVLA) in numpy
|
||||
arrays and do basic data inspection and manipulation using the many
|
||||
python packages that are available.</p>
|
||||
|
||||
<p>Boost.Python made it quite easily possible to create converters for
|
||||
the various data types, also for numpy arrays and individual elements
|
||||
of a numpy array. It's nice they work fully recursively. Mapping C++
|
||||
functions to Python was straightforward.</p>
|
||||
</blockquote>
|
||||
</dd>
|
||||
|
||||
<dt><b><a href="http://www.rdkit.org/"
|
||||
>RDKit: Cheminformatics and Machine Learning Software</a></b></dt>
|
||||
|
||||
<dd>
|
||||
Rational Discovery provides computational modeling, combinatorial
|
||||
library design and custom software development services to the
|
||||
pharmaceutical, biotech and chemical industries. We do a substantial
|
||||
amount of internal research to develop new approaches for applying
|
||||
machine-learning techniques to solve chemical problems. Because we're a
|
||||
small organization and chemistry is a large and complex field, it is
|
||||
essential that we be able to quickly and easily prototype and test new
|
||||
algorithms.
|
||||
|
||||
<p>For our internal software, we implement core data structures in C
|
||||
and expose them to Python using Boost.Python. Algorithm development is
|
||||
done in Python and then translated to C if required (often it's not).
|
||||
This hybrid development approach not only greatly increases our
|
||||
productivity, but it also allows "non-developers" (people without C
|
||||
experience) to take part in method development. Learning C is a
|
||||
daunting task, but "Python fits your brain." (Thanks to Bruce Eckel for
|
||||
the quote.)</p>
|
||||
A collection of cheminformatics and machine-learning software
|
||||
written in C++ and Python.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
@@ -372,8 +372,8 @@ Namespaces are one honking great idea -- let's do more of those!
|
||||
or writing thin wrappers:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="comment">// write "thin wrappers"</span>
|
||||
<span class="keyword">int</span> <span class="identifier">f1</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">x</span><span class="special">);</span> <span class="special">}</span>
|
||||
<span class="keyword">int</span> <span class="identifier">f2</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">double</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">x</span><span class="special">,</span><span class="identifier">y</span><span class="special">);</span> <span class="special">}</span>
|
||||
<span class="keyword">int</span> <span class="identifier">f1</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">x</span><span class="special">);</span> <span class="special">}</span>
|
||||
<span class="keyword">int</span> <span class="identifier">f2</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">double</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">x</span><span class="special">,</span><span class="identifier">y</span><span class="special">);</span> <span class="special">}</span>
|
||||
|
||||
<span class="comment">/*...*/</span>
|
||||
|
||||
|
||||
@@ -901,8 +901,8 @@ wrapping as outlined in the [link python.overloading previous section], or
|
||||
writing thin wrappers:
|
||||
|
||||
// write "thin wrappers"
|
||||
int f1(int x) { f(x); }
|
||||
int f2(int x, double y) { f(x,y); }
|
||||
int f1(int x) { return f(x); }
|
||||
int f2(int x, double y) { return f(x,y); }
|
||||
|
||||
/*...*/
|
||||
|
||||
|
||||
@@ -11,7 +11,10 @@ use-project boost
|
||||
# boost_python library from the project whose global ID is
|
||||
# /boost/python.
|
||||
project
|
||||
: requirements <library>/boost/python//boost_python ;
|
||||
: requirements <library>/boost/python//boost_python
|
||||
<implicit-dependency>/boost//headers
|
||||
: usage-requirements <implicit-dependency>/boost//headers
|
||||
;
|
||||
|
||||
# Declare the three extension modules. You can specify multiple
|
||||
# source files after the colon separated by spaces.
|
||||
|
||||
@@ -12,6 +12,8 @@ use-project boost
|
||||
# /boost/python.
|
||||
project boost-python-quickstart
|
||||
: requirements <library>/boost/python//boost_python
|
||||
<implicit-dependency>/boost//headers
|
||||
: usage-requirements <implicit-dependency>/boost//headers
|
||||
;
|
||||
|
||||
# Make the definition of the python-extension rule available
|
||||
|
||||
@@ -20,7 +20,10 @@ use-project boost
|
||||
# boost_python library from the project whose global ID is
|
||||
# /boost/python.
|
||||
project
|
||||
: requirements <library>/boost/python//boost_python ;
|
||||
: requirements <library>/boost/python//boost_python
|
||||
<implicit-dependency>/boost//headers
|
||||
: usage-requirements <implicit-dependency>/boost//headers
|
||||
;
|
||||
|
||||
# Declare the three extension modules. You can specify multiple
|
||||
# source files after the colon separated by spaces.
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
# include <boost/python/detail/copy_ctor_mutates_rhs.hpp>
|
||||
# include <boost/python/detail/void_ptr.hpp>
|
||||
# include <boost/python/detail/void_return.hpp>
|
||||
# include <boost/utility.hpp>
|
||||
# include <boost/call_traits.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || BOOST_WORKAROUND(BOOST_INTEL_WIN, <= 900)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
|
||||
# include <boost/utility.hpp>
|
||||
# include <boost/noncopyable.hpp>
|
||||
# include <boost/python/type_id.hpp>
|
||||
# include <cstddef>
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
# define CLASS_DWA20011214_HPP
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/utility.hpp>
|
||||
# include <boost/python/object_core.hpp>
|
||||
# include <boost/python/type_id.hpp>
|
||||
# include <cstddef>
|
||||
|
||||
@@ -348,31 +348,14 @@ namespace api
|
||||
// Macros for forwarding constructors in classes derived from
|
||||
// object. Derived classes will usually want these as an
|
||||
// implementation detail
|
||||
# define BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS_(derived, base) \
|
||||
inline explicit derived(python::detail::borrowed_reference p) \
|
||||
: base(p) {} \
|
||||
inline explicit derived(python::detail::new_reference p) \
|
||||
: base(p) {} \
|
||||
inline explicit derived(python::detail::new_non_null_reference p) \
|
||||
# define BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(derived, base) \
|
||||
inline explicit derived(::boost::python::detail::borrowed_reference p) \
|
||||
: base(p) {} \
|
||||
inline explicit derived(::boost::python::detail::new_reference p) \
|
||||
: base(p) {} \
|
||||
inline explicit derived(::boost::python::detail::new_non_null_reference p) \
|
||||
: base(p) {}
|
||||
|
||||
# if !defined(BOOST_MSVC) || BOOST_MSVC >= 1300
|
||||
# define BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS_
|
||||
# else
|
||||
// MSVC6 has a bug which causes an explicit template constructor to
|
||||
// be preferred over an appropriate implicit conversion operator
|
||||
// declared on the argument type. Normally, that would cause a
|
||||
// runtime failure when using extract<T> to extract a type with a
|
||||
// templated constructor. This additional constructor will turn that
|
||||
// runtime failure into an ambiguity error at compile-time due to
|
||||
// the lack of partial ordering, or at least a link-time error if no
|
||||
// generalized template constructor is declared.
|
||||
# define BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(derived, base) \
|
||||
BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS_(derived, base) \
|
||||
template <class T> \
|
||||
explicit derived(extract<T> const&);
|
||||
# endif
|
||||
|
||||
//
|
||||
// object_initializer -- get the handle to construct the object with,
|
||||
// based on whether T is a proxy or derived from object
|
||||
|
||||
@@ -182,13 +182,12 @@ PyTypeObject opaque<Pointee>::type_object =
|
||||
# define BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(Pointee) \
|
||||
namespace boost { namespace python { \
|
||||
template<> \
|
||||
inline type_info type_id<Pointee>(BOOST_PYTHON_EXPLICIT_TT_DEF(Pointee)) \
|
||||
inline type_info type_id<Pointee>() \
|
||||
{ \
|
||||
return type_info (typeid (Pointee *)); \
|
||||
} \
|
||||
template<> \
|
||||
inline type_info type_id<const volatile Pointee&>( \
|
||||
BOOST_PYTHON_EXPLICIT_TT_DEF(const volatile Pointee&)) \
|
||||
inline type_info type_id<const volatile Pointee&>() \
|
||||
{ \
|
||||
return type_info (typeid (Pointee *)); \
|
||||
} \
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/python/object.hpp>
|
||||
# include <boost/python/refcount.hpp>
|
||||
# include <boost/utility.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
|
||||
@@ -69,11 +69,9 @@ struct type_info : private totally_ordered<type_info>
|
||||
base_id_t m_base_type;
|
||||
};
|
||||
|
||||
# ifdef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
|
||||
# define BOOST_PYTHON_EXPLICIT_TT_DEF(T) ::boost::type<T>*
|
||||
# else
|
||||
# define BOOST_PYTHON_EXPLICIT_TT_DEF(T)
|
||||
# endif
|
||||
|
||||
// This macro is obsolete. Port away and remove.
|
||||
# define BOOST_PYTHON_EXPLICIT_TT_DEF(T)
|
||||
|
||||
template <class T>
|
||||
inline type_info type_id(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
|
||||
@@ -99,7 +97,7 @@ inline type_info type_id(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
|
||||
|
||||
# define BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(T) \
|
||||
template <> \
|
||||
inline type_info type_id<T>(BOOST_PYTHON_EXPLICIT_TT_DEF(T)) \
|
||||
inline type_info type_id<T>() \
|
||||
{ \
|
||||
return type_info(typeid(T)); \
|
||||
}
|
||||
@@ -173,13 +171,13 @@ BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream&, type_info const&);
|
||||
|
||||
# if !BOOST_WORKAROUND(BOOST_MSVC, == 1200)
|
||||
template<>
|
||||
inline type_info type_id<void>(BOOST_PYTHON_EXPLICIT_TT_DEF(void))
|
||||
inline type_info type_id<void>()
|
||||
{
|
||||
return type_info (typeid (void *));
|
||||
}
|
||||
# ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template<>
|
||||
inline type_info type_id<const volatile void>(BOOST_PYTHON_EXPLICIT_TT_DEF(const volatile void))
|
||||
inline type_info type_id<const volatile void>()
|
||||
{
|
||||
return type_info (typeid (void *));
|
||||
}
|
||||
|
||||
@@ -377,7 +377,8 @@ namespace
|
||||
static unaryfunc* get_slot(PyObject* obj)
|
||||
{
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
return (PyUnicode_Check(obj)) ? &py_unicode_as_string_unaryfunc : 0;
|
||||
return (PyUnicode_Check(obj)) ? &py_unicode_as_string_unaryfunc :
|
||||
PyBytes_Check(obj) ? &py_object_identity : 0;
|
||||
#else
|
||||
return (PyString_Check(obj)) ? &obj->ob_type->tp_str : 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user