[Cython] template types
Dag Sverre Seljebotn
dagss at student.matnat.uio.no
Wed May 6 07:17:54 CEST 2009
Stefan Behnel wrote:
> Lisandro Dalcin wrote:
>> 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)
>
> Actually, now that I see this - it actually makes sense to think of a
> parametrised type as a meta-type that maps types to types, so a mapping
> syntax makes sense here. If you have more than one type parameter, it'd
> look like this:
>
> myinst = MyClass[(sometype, someothertype)](*args)
Well, in Python there's no way to seperate that from
myinst = MyClass[sometype, someothertype](*args)
which is syntax candy for the same. Of course we can in Cython, but why?
Dag Sverre
More information about the Cython-dev
mailing list