Stefan Behnel schrieb:
> 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)
>
> and the concrete type would basically be 'looked up' at compile time.
>
> It doesn't directly map to an 'obvious' declaration syntax, but I guess
>
> cdef MyType(object) [(sometype, someothertype)]:
> ...
>
> works well enough.
I meant
cdef MyType(object) [(T,V)]:
here, although I now noticed that there is already the "private type" syntax:
cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]:
...
so this won't work straight away either...
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev