[Numpy-discussion] C++ Example
David Cournapeau
cournape@gmail....
Tue Mar 6 17:57:02 CST 2012
On Tue, Mar 6, 2012 at 6:43 PM, Bryan Van de Ven <bryanv@continuum.io> wrote:
> On 3/6/12 2:39 PM, Sturla Molden wrote:
>> We can augment standard C with syntax suger for
>> generics, or even NumPy arrays and Python types, using a Python script
>> as meta-compiler. We don't need C++ for that.
> I can only speak for myself. I do not want to be in the meta-compiler
> business, and I do want proper tool support for templating.
>
> Moreover:
>
> **begin repeat
> *
> * #from = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
> * LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE,
> * CFLOAT, CDOUBLE, CLONGDOUBLE, OBJECT, DATETIME, TIMEDELTA#
> * #suff = bool, byte, ubyte, short, ushort, int, uint, long, ulong,
> * longlong, ulonglong, half, float, double, longdouble,
> * cfloat, cdouble, clongdouble, object, datetime, timedelta#
> * #sort = 1*18, 0*3#
> * #num = 1*15, 2*3, 1*3#
> * #fromtyp = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,
> * longlong, ulonglong, npy_half, float, double, longdouble,
> * float, double, longdouble, PyObject *, datetime, timedelta#
> * #NAME = Bool, Byte, UByte, Short, UShort, Int, UInt, Long, ULong,
> * LongLong, ULongLong, Half, Float, Double, LongDouble,
> * CFloat, CDouble, CLongDouble, Object, Datetime, Timedelta#
> * #kind = GENBOOL, SIGNED, UNSIGNED, SIGNED, UNSIGNED, SIGNED,
> UNSIGNED, SIGNED, UNSIGNED,
> * SIGNED, UNSIGNED, FLOATING, FLOATING, FLOATING, FLOATING,
> * COMPLEX, COMPLEX, COMPLEX, OBJECT, DATETIME, TIMEDELTA#
> * #endian = |*3, =*15, |, =*2#
> * #isobject= 0*18,NPY_OBJECT_DTYPE_FLAGS,0*2#
> */
>
> is not exactly sweet-tasting sugar. It would make more sense for all the
> various values to be bundled together by type, so that a type is
> comprehensible as whole, quickly. Instead all the values are in
> separated property lists that cut across all the types. Worse, very
> similar or identical information to what is in this list is repeated,
> without any chance of consistency or error checking, all over the place.
I don't think anyone likes it . All your points are certainly valid.
There are solutions to this that does not require C++ (Chuck worked on
that I believe, although I guess he knows would rather see C++ used).
David
More information about the NumPy-Discussion
mailing list