[Cython] Literal struct syntax
Stefan Behnel
stefan_ml at behnel.de
Thu Oct 16 16:42:21 CEST 2008
Greg Ewing wrote:
> Stefan Behnel wrote:
>
>> Given this goal, I wonder why the literals are needed in the first
>> place.
>> Currently, you can just do this:
>>
>> p = Point(color=color, x=y)
>
> I thought about that too, but something I had in mind
> for Pyrex in the future was that
>
> p = Point()
>
> where Point is a struct type would be shorthand for
>
> p = <Point *>malloc(sizeof(Point))
IMHO, if we hide the malloc(), we should hide the free(), just as we do
(or Python does) everywhere else. If we can't, it's better to make the
malloc() explicit, too.
Stefan
More information about the Cython-dev
mailing list