It might be allowed but I do not see the point of using it. The most
reasonable way is
cdef int a # or possibly, unsigned int, size_t, etc
for a in range(100):
...
And this has to be thought as the C for loop
int a;
for(a = 0; a < 100; a++) ...
And as Volker said, it is always a good idea
xrange will stilll be allowed in cython files, even after (if) we switch to
python3
Frederic
Le jeudi 20 octobre 2016 11:47:38 UTC+2, Johan S. R. Nielsen a écrit :
>
> >> sage: a = range(10**8) # takes a lot of memory
> >> sage: del a# free the memory
> >
> > Ok, so now,
>> sage: a = range(10**8) # takes a lot of memory
>> sage: del a# free the memory
>
> Ok, so now, I understand why it takes the memory: a list was created.
Using xrange instead of range will also avoid creating the list even
without cdef'ing a (the code is still slow of cour
On Thursday, October 20, 2016 at 8:42:05 AM UTC+2, vdelecroix wrote:
> It might not be a leak. *After* the loop the memory should be back to
> normal. The very same as with
>
> sage: a = range(10**8) # takes a lot of memory
> sage: del a# free the memory
Ok, so now, I und
On Thursday, October 20, 2016 at 1:19:51 AM UTC+2, Sébastien Labbé wrote:
>
> Does this also explain the leak?
>
Freed memory is not immediately returned to the system (mostly because it
would be hilariously slow for small allocations). Whether a one-off
computation increases process memory usag
It might not be a leak. *After* the loop the memory should be back to
normal. The very same as with
sage: a = range(10**8) # takes a lot of memory
sage: del a# free the memory
Vincent
PS: This would have been different with Python 3.
--
You received this message because yo
Does this also explain the leak?
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage
PS: Write your code in a file and compile it with "cython -a myfile.pyx",
that generates a html file with explanations.
On Thursday, October 20, 2016 at 1:11:14 AM UTC+2, Volker Braun wrote:
>
> Thats the expected behavoir. Without type annotation, cython just does the
> same as Python (creat
Thats the expected behavoir. Without type annotation, cython just does the
same as Python (create a list of 10**8 elements and iterate over). With
type annotation it is a C-level for loop.
On Thursday, October 20, 2016 at 12:33:47 AM UTC+2, Sébastien Labbé wrote:
>
> Dear sage-devel,
>
> Writin