On Thu, Sep 20, 2012 at 9:55 AM, Chris Barker <
chris....@noaa.gov> wrote:
> I'm thinking of using namedtuples in Cython -- it seems a reasonable
> way to wrap a c struct, and, at least in pure python, lighter weight
> than a class.
>
> If I'm going to do that, is seems I might as well use the C-API when
> constructing, rather than doing it all with the Python API. But it
> appears the namedtuple is written in pure python, as a subclass of
> tuple.
>
> Which I suppose means I need to create a nametuple class with the
> Python call, but then I should be able to actually set the fields with
> the C-API for a tuple.
>
> But is there any point in this anyway -- is, in fact, a cdef class
> just as lightweight (or maybe more lightweight) anyway?
every set of names you want. (It also has the advantage of storing