On Tue, May 5, 2009 at 4:59 PM, Dag Sverre Seljebotn <[email protected]> wrote: > > OTOH, this brings up another interesting question: What happens with > exporting templates to Python-land? >
SWIG supports templates and exposing templates to Python side... but having to choose a name for the "instantiation" always bothered me... At some point, I've started to use some hackery via a registry and a custom class abusing of __getitem__() to support on Python side: myinst = MyClass[sometype](args) At first, I was tempted to use "MyClass(sometype)(args)", but almost immediately I ruled it out because that was too much confusing. So, I'm +1 on "[]" for templates... > > (I'd say that's a valid usecase eventually, but of course not something > to support at first. > Why not? IMHO, that would be easiest part to implement from the whole beast (assuming that a registry and a companion type implementing dispatching via __getitem__() would be enough). > But it /does/ impact the chosen syntax quite > heavily as <> is ruled straight out.) > Indeed. That's the reason I support "[]" for templates over the C++/D way. -- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
