[Cython] Proposal: idea for automatic management of dynamic memory
Stefan Behnel
stefan_ml at behnel.de
Fri Apr 11 14:30:14 CEST 2008
Hi,
Robert Bradshaw wrote:
> On Apr 11, 2008, at 4:21 AM, Dag Sverre Seljebotn wrote:
>> Stefan wrote:
>>> BTW, do we actually support cdef's inside blocks?
>>>
>> No, I forgot. That was one of the first things that surprised me when
>> starting to use Cython, it would be nice to have that (any philosophical
>> reasons against it, or just that it was simpler to implement?)
>
> I actually have no idea--this is just how Cython was. I don't think
> there's any technical barrier (and I do find it annoying sometimes), but
> it is a reminder that Python locals are not scoped by block (and so nor
> should Cython's).
I don't quite remember my first reaction, but I guess I would also be
surprised as a newbie.
This is (again) sort of an in-between C and Python question. "cdef" enters C
space, where block-scoping makes sense. However, we'd have to resolve all
sorts of weird semantic nonsense, such as:
cdef object i
for i in range(10):
cdef long i = i
...
I don't feel like bothering with that...
Stefan
More information about the Cython-dev
mailing list