mirror of
https://github.com/boostorg/python.git
synced 2026-01-19 04:22:16 +00:00
Merge branch 'develop'
This commit is contained in:
@@ -52,7 +52,6 @@ rule lib_boost_python ( version )
|
||||
{
|
||||
lib $(lib_boost_python($(version)))
|
||||
: # sources
|
||||
numeric.cpp
|
||||
list.cpp
|
||||
long.cpp
|
||||
dict.cpp
|
||||
|
||||
BIN
doc/images/jam.png
Normal file
BIN
doc/images/jam.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
@@ -92,7 +92,7 @@ who had to use a different tool.
|
||||
|
||||
We will skip over the details. Our objective will be to simply create
|
||||
the hello world module and run it in Python. For a complete reference to
|
||||
building Boost.Python, check out: [@../../../building.html
|
||||
building Boost.Python, check out: [@../building.html
|
||||
building.html]. After this brief ['bjam] tutorial, we should have built
|
||||
the DLLs and run a python program using the extension.
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
# include <boost/python/make_function.hpp>
|
||||
# include <boost/python/manage_new_object.hpp>
|
||||
# include <boost/python/module.hpp>
|
||||
# include <boost/python/numeric.hpp>
|
||||
# include <boost/python/object.hpp>
|
||||
# include <boost/python/object_protocol.hpp>
|
||||
# include <boost/python/object_protocol_core.hpp>
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
// Copyright David Abrahams 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef NUMARRAY_DWA2002922_HPP
|
||||
# define NUMARRAY_DWA2002922_HPP
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
|
||||
# include <boost/python/tuple.hpp>
|
||||
# include <boost/python/str.hpp>
|
||||
# include <boost/preprocessor/iteration/local.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/repetition/enum.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace numeric {
|
||||
|
||||
class array;
|
||||
|
||||
namespace aux
|
||||
{
|
||||
struct BOOST_PYTHON_DECL array_base : object
|
||||
{
|
||||
# define BOOST_PP_LOCAL_MACRO(n) \
|
||||
array_base(BOOST_PP_ENUM_PARAMS_Z(1, n, object const& x));
|
||||
# define BOOST_PP_LOCAL_LIMITS (1, 7)
|
||||
# include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
object argmax(long axis=-1);
|
||||
object argmin(long axis=-1);
|
||||
object argsort(long axis=-1);
|
||||
object astype(object const& type = object());
|
||||
void byteswap();
|
||||
object copy() const;
|
||||
object diagonal(long offset = 0, long axis1 = 0, long axis2 = 1) const;
|
||||
void info() const;
|
||||
bool is_c_array() const;
|
||||
bool isbyteswapped() const;
|
||||
array new_(object type) const;
|
||||
void sort();
|
||||
object trace(long offset = 0, long axis1 = 0, long axis2 = 1) const;
|
||||
object type() const;
|
||||
char typecode() const;
|
||||
|
||||
object factory(
|
||||
object const& sequence = object()
|
||||
, object const& typecode = object()
|
||||
, bool copy = true
|
||||
, bool savespace = false
|
||||
, object type = object()
|
||||
, object shape = object());
|
||||
|
||||
object getflat() const;
|
||||
long getrank() const;
|
||||
object getshape() const;
|
||||
bool isaligned() const;
|
||||
bool iscontiguous() const;
|
||||
long itemsize() const;
|
||||
long nelements() const;
|
||||
object nonzero() const;
|
||||
|
||||
void put(object const& indices, object const& values);
|
||||
|
||||
void ravel();
|
||||
|
||||
object repeat(object const& repeats, long axis=0);
|
||||
|
||||
void resize(object const& shape);
|
||||
|
||||
void setflat(object const& flat);
|
||||
void setshape(object const& shape);
|
||||
|
||||
void swapaxes(long axis1, long axis2);
|
||||
|
||||
object take(object const& sequence, long axis = 0) const;
|
||||
|
||||
void tofile(object const& file) const;
|
||||
|
||||
str tostring() const;
|
||||
|
||||
void transpose(object const& axes = object());
|
||||
|
||||
object view() const;
|
||||
|
||||
public: // implementation detail - do not touch.
|
||||
BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(array_base, object);
|
||||
};
|
||||
|
||||
struct BOOST_PYTHON_DECL array_object_manager_traits
|
||||
{
|
||||
static bool check(PyObject* obj);
|
||||
static detail::new_non_null_reference adopt(PyObject* obj);
|
||||
static PyTypeObject const* get_pytype() ;
|
||||
};
|
||||
} // namespace aux
|
||||
|
||||
class array : public aux::array_base
|
||||
{
|
||||
typedef aux::array_base base;
|
||||
public:
|
||||
|
||||
object astype() { return base::astype(); }
|
||||
|
||||
template <class Type>
|
||||
object astype(Type const& type_)
|
||||
{
|
||||
return base::astype(object(type_));
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
array new_(Type const& type_) const
|
||||
{
|
||||
return base::new_(object(type_));
|
||||
}
|
||||
|
||||
template <class Sequence>
|
||||
void resize(Sequence const& x)
|
||||
{
|
||||
base::resize(object(x));
|
||||
}
|
||||
|
||||
# define BOOST_PP_LOCAL_MACRO(n) \
|
||||
void resize(BOOST_PP_ENUM_PARAMS_Z(1, n, long x)) \
|
||||
{ \
|
||||
resize(make_tuple(BOOST_PP_ENUM_PARAMS_Z(1, n, x))); \
|
||||
}
|
||||
# define BOOST_PP_LOCAL_LIMITS (1, BOOST_PYTHON_MAX_ARITY)
|
||||
# include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
template <class Sequence>
|
||||
void setshape(Sequence const& x)
|
||||
{
|
||||
base::setshape(object(x));
|
||||
}
|
||||
|
||||
# define BOOST_PP_LOCAL_MACRO(n) \
|
||||
void setshape(BOOST_PP_ENUM_PARAMS_Z(1, n, long x)) \
|
||||
{ \
|
||||
setshape(make_tuple(BOOST_PP_ENUM_PARAMS_Z(1, n, x))); \
|
||||
}
|
||||
# define BOOST_PP_LOCAL_LIMITS (1, BOOST_PYTHON_MAX_ARITY)
|
||||
# include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
template <class Indices, class Values>
|
||||
void put(Indices const& indices, Values const& values)
|
||||
{
|
||||
base::put(object(indices), object(values));
|
||||
}
|
||||
|
||||
template <class Sequence>
|
||||
object take(Sequence const& sequence, long axis = 0)
|
||||
{
|
||||
return base::take(object(sequence), axis);
|
||||
}
|
||||
|
||||
template <class File>
|
||||
void tofile(File const& f) const
|
||||
{
|
||||
base::tofile(object(f));
|
||||
}
|
||||
|
||||
object factory()
|
||||
{
|
||||
return base::factory();
|
||||
}
|
||||
|
||||
template <class Sequence>
|
||||
object factory(Sequence const& sequence)
|
||||
{
|
||||
return base::factory(object(sequence));
|
||||
}
|
||||
|
||||
template <class Sequence, class Typecode>
|
||||
object factory(
|
||||
Sequence const& sequence
|
||||
, Typecode const& typecode_
|
||||
, bool copy = true
|
||||
, bool savespace = false
|
||||
)
|
||||
{
|
||||
return base::factory(object(sequence), object(typecode_), copy, savespace);
|
||||
}
|
||||
|
||||
template <class Sequence, class Typecode, class Type>
|
||||
object factory(
|
||||
Sequence const& sequence
|
||||
, Typecode const& typecode_
|
||||
, bool copy
|
||||
, bool savespace
|
||||
, Type const& type
|
||||
)
|
||||
{
|
||||
return base::factory(object(sequence), object(typecode_), copy, savespace, object(type));
|
||||
}
|
||||
|
||||
template <class Sequence, class Typecode, class Type, class Shape>
|
||||
object factory(
|
||||
Sequence const& sequence
|
||||
, Typecode const& typecode_
|
||||
, bool copy
|
||||
, bool savespace
|
||||
, Type const& type
|
||||
, Shape const& shape
|
||||
)
|
||||
{
|
||||
return base::factory(object(sequence), object(typecode_), copy, savespace, object(type), object(shape));
|
||||
}
|
||||
|
||||
# define BOOST_PYTHON_ENUM_AS_OBJECT(z, n, x) object(BOOST_PP_CAT(x,n))
|
||||
# define BOOST_PP_LOCAL_MACRO(n) \
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(1, n, class T)> \
|
||||
explicit array(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, n, T, const& x)) \
|
||||
: base(BOOST_PP_ENUM_1(n, BOOST_PYTHON_ENUM_AS_OBJECT, x)) \
|
||||
{}
|
||||
# define BOOST_PP_LOCAL_LIMITS (1, 7)
|
||||
# include BOOST_PP_LOCAL_ITERATE()
|
||||
# undef BOOST_PYTHON_AS_OBJECT
|
||||
|
||||
static BOOST_PYTHON_DECL void set_module_and_type(char const* package_name = 0, char const* type_attribute_name = 0);
|
||||
static BOOST_PYTHON_DECL std::string get_module_name();
|
||||
|
||||
public: // implementation detail -- for internal use only
|
||||
BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(array, base);
|
||||
};
|
||||
|
||||
} // namespace boost::python::numeric
|
||||
|
||||
namespace converter
|
||||
{
|
||||
template <>
|
||||
struct object_manager_traits< numeric::array >
|
||||
: numeric::aux::array_object_manager_traits
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, is_specialized = true);
|
||||
};
|
||||
}
|
||||
|
||||
}} // namespace boost::python
|
||||
|
||||
#endif // NUMARRAY_DWA2002922_HPP
|
||||
@@ -16,8 +16,7 @@ env1.AppendUnique(CPPDEFINES = ['BOOST_PYTHON_SOURCE'])
|
||||
|
||||
env1.BoostLibrary(
|
||||
'python',
|
||||
['numeric.cpp',
|
||||
'list.cpp',
|
||||
['list.cpp',
|
||||
'long.cpp',
|
||||
'dict.cpp',
|
||||
'tuple.cpp',
|
||||
|
||||
325
src/numeric.cpp
325
src/numeric.cpp
@@ -1,325 +0,0 @@
|
||||
// Copyright David Abrahams 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/python/numeric.hpp>
|
||||
#include <boost/python/handle.hpp>
|
||||
#include <boost/python/cast.hpp>
|
||||
#include <boost/python/tuple.hpp>
|
||||
#include <boost/python/detail/raw_pyobject.hpp>
|
||||
#include <boost/python/extract.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace numeric {
|
||||
|
||||
namespace
|
||||
{
|
||||
enum state_t { failed = -1, unknown, succeeded };
|
||||
state_t state = unknown;
|
||||
std::string module_name;
|
||||
std::string type_name;
|
||||
|
||||
handle<> array_module;
|
||||
handle<> array_type;
|
||||
handle<> array_function;
|
||||
|
||||
void throw_load_failure()
|
||||
{
|
||||
PyErr_Format(
|
||||
PyExc_ImportError
|
||||
, "No module named '%s' or its type '%s' did not follow the NumPy protocol"
|
||||
, module_name.c_str(), type_name.c_str());
|
||||
throw_error_already_set();
|
||||
|
||||
}
|
||||
|
||||
bool load(bool throw_on_error)
|
||||
{
|
||||
if (!state)
|
||||
{
|
||||
if (module_name.size() == 0)
|
||||
{
|
||||
module_name = "numarray";
|
||||
type_name = "NDArray";
|
||||
if (load(false))
|
||||
return true;
|
||||
module_name = "Numeric";
|
||||
type_name = "ArrayType";
|
||||
}
|
||||
|
||||
state = failed;
|
||||
PyObject* module = ::PyImport_Import(object(module_name).ptr());
|
||||
if (module)
|
||||
{
|
||||
PyObject* type = ::PyObject_GetAttrString(module, const_cast<char*>(type_name.c_str()));
|
||||
|
||||
if (type && PyType_Check(type))
|
||||
{
|
||||
array_type = handle<>(type);
|
||||
PyObject* function = ::PyObject_GetAttrString(module, const_cast<char*>("array"));
|
||||
|
||||
if (function && PyCallable_Check(function))
|
||||
{
|
||||
array_function = handle<>(function);
|
||||
state = succeeded;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state == succeeded)
|
||||
return true;
|
||||
|
||||
if (throw_on_error)
|
||||
throw_load_failure();
|
||||
|
||||
PyErr_Clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
object demand_array_function()
|
||||
{
|
||||
load(true);
|
||||
return object(array_function);
|
||||
}
|
||||
}
|
||||
|
||||
void array::set_module_and_type(char const* package_name, char const* type_attribute_name)
|
||||
{
|
||||
state = unknown;
|
||||
module_name = package_name ? package_name : "" ;
|
||||
type_name = type_attribute_name ? type_attribute_name : "" ;
|
||||
}
|
||||
|
||||
std::string array::get_module_name()
|
||||
{
|
||||
load(false);
|
||||
return module_name;
|
||||
}
|
||||
|
||||
namespace aux
|
||||
{
|
||||
bool array_object_manager_traits::check(PyObject* obj)
|
||||
{
|
||||
if (!load(false))
|
||||
return false;
|
||||
return ::PyObject_IsInstance(obj, array_type.get());
|
||||
}
|
||||
|
||||
python::detail::new_non_null_reference
|
||||
array_object_manager_traits::adopt(PyObject* obj)
|
||||
{
|
||||
load(true);
|
||||
return detail::new_non_null_reference(
|
||||
pytype_check(downcast<PyTypeObject>(array_type.get()), obj));
|
||||
}
|
||||
|
||||
PyTypeObject const* array_object_manager_traits::get_pytype()
|
||||
{
|
||||
load(false);
|
||||
if(!array_type) return 0;
|
||||
return downcast<PyTypeObject>(array_type.get());
|
||||
}
|
||||
|
||||
# define BOOST_PYTHON_AS_OBJECT(z, n, _) object(x##n)
|
||||
# define BOOST_PP_LOCAL_MACRO(n) \
|
||||
array_base::array_base(BOOST_PP_ENUM_PARAMS(n, object const& x)) \
|
||||
: object(demand_array_function()(BOOST_PP_ENUM_PARAMS(n, x))) \
|
||||
{}
|
||||
# define BOOST_PP_LOCAL_LIMITS (1, 6)
|
||||
# include BOOST_PP_LOCAL_ITERATE()
|
||||
# undef BOOST_PYTHON_AS_OBJECT
|
||||
|
||||
array_base::array_base(BOOST_PP_ENUM_PARAMS(7, object const& x))
|
||||
: object(demand_array_function()(BOOST_PP_ENUM_PARAMS(7, x)))
|
||||
{}
|
||||
|
||||
object array_base::argmax(long axis)
|
||||
{
|
||||
return attr("argmax")(axis);
|
||||
}
|
||||
|
||||
object array_base::argmin(long axis)
|
||||
{
|
||||
return attr("argmin")(axis);
|
||||
}
|
||||
|
||||
object array_base::argsort(long axis)
|
||||
{
|
||||
return attr("argsort")(axis);
|
||||
}
|
||||
|
||||
object array_base::astype(object const& type)
|
||||
{
|
||||
return attr("astype")(type);
|
||||
}
|
||||
|
||||
void array_base::byteswap()
|
||||
{
|
||||
attr("byteswap")();
|
||||
}
|
||||
|
||||
object array_base::copy() const
|
||||
{
|
||||
return attr("copy")();
|
||||
}
|
||||
|
||||
object array_base::diagonal(long offset, long axis1, long axis2) const
|
||||
{
|
||||
return attr("diagonal")(offset, axis1, axis2);
|
||||
}
|
||||
|
||||
void array_base::info() const
|
||||
{
|
||||
attr("info")();
|
||||
}
|
||||
|
||||
bool array_base::is_c_array() const
|
||||
{
|
||||
return extract<bool>(attr("is_c_array")());
|
||||
}
|
||||
|
||||
bool array_base::isbyteswapped() const
|
||||
{
|
||||
return extract<bool>(attr("isbyteswapped")());
|
||||
}
|
||||
|
||||
array array_base::new_(object type) const
|
||||
{
|
||||
return extract<array>(attr("new")(type))();
|
||||
}
|
||||
|
||||
void array_base::sort()
|
||||
{
|
||||
attr("sort")();
|
||||
}
|
||||
|
||||
object array_base::trace(long offset, long axis1, long axis2) const
|
||||
{
|
||||
return attr("trace")(offset, axis1, axis2);
|
||||
}
|
||||
|
||||
object array_base::type() const
|
||||
{
|
||||
return attr("type")();
|
||||
}
|
||||
|
||||
char array_base::typecode() const
|
||||
{
|
||||
return extract<char>(attr("typecode")());
|
||||
}
|
||||
|
||||
object array_base::factory(
|
||||
object const& sequence
|
||||
, object const& typecode
|
||||
, bool copy
|
||||
, bool savespace
|
||||
, object type
|
||||
, object shape
|
||||
)
|
||||
{
|
||||
return attr("factory")(sequence, typecode, copy, savespace, type, shape);
|
||||
}
|
||||
|
||||
object array_base::getflat() const
|
||||
{
|
||||
return attr("getflat")();
|
||||
}
|
||||
|
||||
long array_base::getrank() const
|
||||
{
|
||||
return extract<long>(attr("getrank")());
|
||||
}
|
||||
|
||||
object array_base::getshape() const
|
||||
{
|
||||
return attr("getshape")();
|
||||
}
|
||||
|
||||
bool array_base::isaligned() const
|
||||
{
|
||||
return extract<bool>(attr("isaligned")());
|
||||
}
|
||||
|
||||
bool array_base::iscontiguous() const
|
||||
{
|
||||
return extract<bool>(attr("iscontiguous")());
|
||||
}
|
||||
|
||||
long array_base::itemsize() const
|
||||
{
|
||||
return extract<long>(attr("itemsize")());
|
||||
}
|
||||
|
||||
long array_base::nelements() const
|
||||
{
|
||||
return extract<long>(attr("nelements")());
|
||||
}
|
||||
|
||||
object array_base::nonzero() const
|
||||
{
|
||||
return attr("nonzero")();
|
||||
}
|
||||
|
||||
void array_base::put(object const& indices, object const& values)
|
||||
{
|
||||
attr("put")(indices, values);
|
||||
}
|
||||
|
||||
void array_base::ravel()
|
||||
{
|
||||
attr("ravel")();
|
||||
}
|
||||
|
||||
object array_base::repeat(object const& repeats, long axis)
|
||||
{
|
||||
return attr("repeat")(repeats, axis);
|
||||
}
|
||||
|
||||
void array_base::resize(object const& shape)
|
||||
{
|
||||
attr("resize")(shape);
|
||||
}
|
||||
|
||||
void array_base::setflat(object const& flat)
|
||||
{
|
||||
attr("setflat")(flat);
|
||||
}
|
||||
|
||||
void array_base::setshape(object const& shape)
|
||||
{
|
||||
attr("setshape")(shape);
|
||||
}
|
||||
|
||||
void array_base::swapaxes(long axis1, long axis2)
|
||||
{
|
||||
attr("swapaxes")(axis1, axis2);
|
||||
}
|
||||
|
||||
object array_base::take(object const& sequence, long axis) const
|
||||
{
|
||||
return attr("take")(sequence, axis);
|
||||
}
|
||||
|
||||
void array_base::tofile(object const& file) const
|
||||
{
|
||||
attr("tofile")(file);
|
||||
}
|
||||
|
||||
str array_base::tostring() const
|
||||
{
|
||||
return str(attr("tostring")());
|
||||
}
|
||||
|
||||
void array_base::transpose(object const& axes)
|
||||
{
|
||||
attr("transpose")(axes);
|
||||
}
|
||||
|
||||
object array_base::view() const
|
||||
{
|
||||
return attr("view")();
|
||||
}
|
||||
}
|
||||
|
||||
}}} // namespace boost::python::numeric
|
||||
@@ -52,47 +52,6 @@ bool check_string_rich_slice()
|
||||
return "assertion failed: " #e1 " == " #e2 "\nLHS:\n%s\nRHS:\n%s" % make_tuple(e1,e2); \
|
||||
else
|
||||
|
||||
// These tests work with Python 2.2, but you must have Numeric installed.
|
||||
object check_numeric_array_rich_slice(
|
||||
char const* module_name, char const* array_type_name, object all)
|
||||
{
|
||||
using numeric::array;
|
||||
array::set_module_and_type(module_name, array_type_name);
|
||||
|
||||
array original = array( make_tuple( make_tuple( 11, 12, 13, 14),
|
||||
make_tuple( 21, 22, 23, 24),
|
||||
make_tuple( 31, 32, 33, 34),
|
||||
make_tuple( 41, 42, 43, 44)));
|
||||
array upper_left_quadrant = array( make_tuple( make_tuple( 11, 12),
|
||||
make_tuple( 21, 22)));
|
||||
array odd_cells = array( make_tuple( make_tuple( 11, 13),
|
||||
make_tuple( 31, 33)));
|
||||
array even_cells = array( make_tuple( make_tuple( 22, 24),
|
||||
make_tuple( 42, 44)));
|
||||
array lower_right_quadrant_reversed = array(
|
||||
make_tuple( make_tuple(44, 43),
|
||||
make_tuple(34, 33)));
|
||||
|
||||
// The following comments represent equivalent Python expressions used
|
||||
// to validate the array behavior.
|
||||
// original[::] == original
|
||||
ASSERT_EQUAL(original[slice()],original);
|
||||
|
||||
// original[:2,:2] == array( [[11, 12], [21, 22]])
|
||||
ASSERT_EQUAL(original[make_tuple(slice(_,2), slice(_,2))],upper_left_quadrant);
|
||||
|
||||
// original[::2,::2] == array( [[11, 13], [31, 33]])
|
||||
ASSERT_EQUAL(original[make_tuple( slice(_,_,2), slice(_,_,2))],odd_cells);
|
||||
|
||||
// original[1::2, 1::2] == array( [[22, 24], [42, 44]])
|
||||
ASSERT_EQUAL(original[make_tuple( slice(1,_,2), slice(1,_,2))],even_cells);
|
||||
|
||||
// original[:-3:-1, :-3,-1] == array( [[44, 43], [34, 33]])
|
||||
ASSERT_EQUAL(original[make_tuple( slice(_,-3,-1), slice(_,-3,-1))],lower_right_quadrant_reversed);
|
||||
|
||||
return object(1);
|
||||
}
|
||||
|
||||
// Verify functions accepting a slice argument can be called
|
||||
bool accept_slice( slice) { return true; }
|
||||
|
||||
@@ -134,7 +93,6 @@ int check_slice_get_indices(
|
||||
BOOST_PYTHON_MODULE(slice_ext)
|
||||
{
|
||||
def( "accept_slice", accept_slice);
|
||||
def( "check_numeric_array_rich_slice", check_numeric_array_rich_slice);
|
||||
def( "check_string_rich_slice", check_string_rich_slice);
|
||||
def( "check_slice_get_indices", check_slice_get_indices);
|
||||
}
|
||||
|
||||
@@ -12,22 +12,6 @@
|
||||
... print("test passed")
|
||||
...
|
||||
test passed
|
||||
>>> try:
|
||||
... from Numeric import array
|
||||
... except:
|
||||
... print(1)
|
||||
... else:
|
||||
... check_numeric_array_rich_slice('Numeric', 'ArrayType', lambda x:x)
|
||||
...
|
||||
1
|
||||
>>> try:
|
||||
... from numarray import array, all
|
||||
... except:
|
||||
... print(1)
|
||||
... else:
|
||||
... check_numeric_array_rich_slice('numarray', 'NDArray', all)
|
||||
...
|
||||
1
|
||||
>>> import sys
|
||||
>>> if sys.version_info[0] == 2 and sys.version_info[1] >= 3:
|
||||
... check_string_rich_slice()
|
||||
@@ -51,9 +35,7 @@ test passed
|
||||
6
|
||||
"""
|
||||
|
||||
# Performs an affirmative and negative argument resolution check,
|
||||
# checks the operation of extended slicing in Numeric arrays
|
||||
# (only performed if Numeric.array or numarray.array can be found).
|
||||
# Performs an affirmative and negative argument resolution check.
|
||||
# checks the operation of extended slicing in new strings (Python 2.3 only).
|
||||
|
||||
def run(args = None):
|
||||
|
||||
Reference in New Issue
Block a user